##// END OF EJS Templates
rust-chg: remove SIGCHLD handler which won't work in oxidized chg...
Yuya Nishihara -
r40155:e70b616a default
parent child Browse files
Show More
@@ -11,16 +11,8 b''
11 #include <errno.h>
11 #include <errno.h>
12 #include <signal.h>
12 #include <signal.h>
13 #include <string.h>
13 #include <string.h>
14 #include <sys/wait.h>
15 #include <unistd.h>
14 #include <unistd.h>
16
15
17 #ifdef __GNUC__
18 #define UNUSED_ __attribute__((unused))
19 #else
20 #define UNUSED_
21 #endif
22
23 static pid_t pagerpid = 0;
24 static pid_t peerpgid = 0;
16 static pid_t peerpgid = 0;
25 static pid_t peerpid = 0;
17 static pid_t peerpid = 0;
26
18
@@ -65,17 +57,6 b' static void handlestopsignal(int sig)'
65 return;
57 return;
66 }
58 }
67
59
68 static void handlechildsignal(int sig UNUSED_)
69 {
70 if (peerpid == 0 || pagerpid == 0)
71 return;
72 /* if pager exits, notify the server with SIGPIPE immediately.
73 * otherwise the server won't get SIGPIPE if it does not write
74 * anything. (issue5278) */
75 if (waitpid(pagerpid, NULL, WNOHANG) == pagerpid)
76 kill(peerpid, SIGPIPE);
77 }
78
79 /*
60 /*
80 * Installs signal handlers.
61 * Installs signal handlers.
81 *
62 *
@@ -131,11 +112,6 b' int setupsignalhandler(pid_t pid, pid_t '
131 sa.sa_flags = SA_RESTART;
112 sa.sa_flags = SA_RESTART;
132 if (sigaction(SIGTSTP, &sa, NULL) < 0)
113 if (sigaction(SIGTSTP, &sa, NULL) < 0)
133 return -1;
114 return -1;
134 /* get notified when pager exits */
135 sa.sa_handler = handlechildsignal;
136 sa.sa_flags = SA_RESTART;
137 if (sigaction(SIGCHLD, &sa, NULL) < 0)
138 return -1;
139
115
140 return 0;
116 return 0;
141 }
117 }
@@ -164,8 +140,6 b' int restoresignalhandler(void)'
164 return -1;
140 return -1;
165 if (sigaction(SIGTSTP, &sa, NULL) < 0)
141 if (sigaction(SIGTSTP, &sa, NULL) < 0)
166 return -1;
142 return -1;
167 if (sigaction(SIGCHLD, &sa, NULL) < 0)
168 return -1;
169
143
170 /* ignore Ctrl+C while shutting down to make pager exits cleanly */
144 /* ignore Ctrl+C while shutting down to make pager exits cleanly */
171 sa.sa_handler = SIG_IGN;
145 sa.sa_handler = SIG_IGN;
@@ -53,6 +53,10 b' impl SystemHandler for ChgUiHandler {'
53 .spawn_async()?;
53 .spawn_async()?;
54 let pin = pager.stdin().take().unwrap();
54 let pin = pager.stdin().take().unwrap();
55 procutil::set_blocking_fd(pin.as_raw_fd())?;
55 procutil::set_blocking_fd(pin.as_raw_fd())?;
56 // TODO: if pager exits, notify the server with SIGPIPE immediately.
57 // otherwise the server won't get SIGPIPE if it does not write
58 // anything. (issue5278)
59 // kill(peerpid, SIGPIPE);
56 tokio::spawn(pager.map(|_| ()).map_err(|_| ())); // just ignore errors
60 tokio::spawn(pager.map(|_| ()).map_err(|_| ())); // just ignore errors
57 Ok((self, pin))
61 Ok((self, pin))
58 }
62 }
General Comments 0
You need to be logged in to leave comments. Login now