about summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-11-13 10:42:05 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-12-19 16:11:09 -0300
commit478f70780f28a270205ddbe8cb6ec29cb41d586e (patch)
treec46c10ac218ba891188667249f5cb52755e4351c /libio
parent6a265e577e8d7c9c950a793139df19b2d050ce5b (diff)
downloadglibc-478f70780f28a270205ddbe8cb6ec29cb41d586e.tar.gz
glibc-478f70780f28a270205ddbe8cb6ec29cb41d586e.tar.xz
glibc-478f70780f28a270205ddbe8cb6ec29cb41d586e.zip
Remove __waitpid_nocancel
It enables and disables cancellation with pthread_setcancelstate
before calling the waitpid.  It simplifies the waitpid implementation
for architectures that do not provide either __NR_waitpid or
__NR_wait4.

Checked on x86_64-linux-gnu.
Diffstat (limited to 'libio')
-rw-r--r--libio/iopopen.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libio/iopopen.c b/libio/iopopen.c
index 22d53a88ef..a15d3bf4b6 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -281,7 +281,11 @@ _IO_new_proc_close (FILE *fp)
      described in POSIX.2, such implementations are not conforming." */
   do
     {
-      wait_pid = __waitpid_nocancel (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      int state;
+      __libc_ptf_call (__pthread_setcancelstate,
+		       (PTHREAD_CANCEL_DISABLE, &state), 0);
+      wait_pid = __waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+      __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
     }
   while (wait_pid == -1 && errno == EINTR);
   if (wait_pid == -1)