##// 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 11 #include <errno.h>
12 12 #include <signal.h>
13 13 #include <string.h>
14 #include <sys/wait.h>
15 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 16 static pid_t peerpgid = 0;
25 17 static pid_t peerpid = 0;
26 18
@@ -65,17 +57,6 b' static void handlestopsignal(int sig)'
65 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 61 * Installs signal handlers.
81 62 *
@@ -131,11 +112,6 b' int setupsignalhandler(pid_t pid, pid_t '
131 112 sa.sa_flags = SA_RESTART;
132 113 if (sigaction(SIGTSTP, &sa, NULL) < 0)
133 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 116 return 0;
141 117 }
@@ -164,8 +140,6 b' int restoresignalhandler(void)'
164 140 return -1;
165 141 if (sigaction(SIGTSTP, &sa, NULL) < 0)
166 142 return -1;
167 if (sigaction(SIGCHLD, &sa, NULL) < 0)
168 return -1;
169 143
170 144 /* ignore Ctrl+C while shutting down to make pager exits cleanly */
171 145 sa.sa_handler = SIG_IGN;
@@ -53,6 +53,10 b' impl SystemHandler for ChgUiHandler {'
53 53 .spawn_async()?;
54 54 let pin = pager.stdin().take().unwrap();
55 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 60 tokio::spawn(pager.map(|_| ()).map_err(|_| ())); // just ignore errors
57 61 Ok((self, pin))
58 62 }
General Comments 0
You need to be logged in to leave comments. Login now