pclose.c raw

   1  #include "stdio_impl.h"
   2  #include <errno.h>
   3  #include <unistd.h>
   4  
   5  int pclose(FILE *f)
   6  {
   7  	int status, r;
   8  	pid_t pid = f->pipe_pid;
   9  	fclose(f);
  10  	while ((r=__syscall(SYS_wait4, pid, &status, 0, 0)) == -EINTR);
  11  	if (r<0) return __syscall_ret(r);
  12  	return status;
  13  }
  14