diff --git a/include/unistd.h b/include/unistd.h index d61c405..b2ae948 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -566,7 +566,6 @@ extern __pid_t __getpgrp (void) __THROW; #endif /* Get the process group ID of process PID. */ -extern __pid_t __getpgid (__pid_t __pid) __THROW; #ifdef __USE_XOPEN_EXTENDED extern __pid_t getpgid (__pid_t __pid) __THROW; #endif @@ -576,7 +575,6 @@ extern __pid_t getpgid (__pid_t __pid) __THROW; If PID is zero, the current process's process group ID is set. If PGID is zero, the process ID of the process is used. */ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; -extern int __setpgid (__pid_t __pid, __pid_t __pgid) __THROW; #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED /* Both System V and BSD have `setpgrp' functions, but with different diff --git a/unix/getpgid.c b/unix/getpgid.c index eb2ffca..5e78112 100644 --- a/unix/getpgid.c +++ b/unix/getpgid.c @@ -12,7 +12,7 @@ #include #include -int __bsd_getpgrp (int pid); +__typeof__(getpgid) __getpgid; pid_t __getpgid (pid_t pid) diff --git a/unix/setpgid.c b/unix/setpgid.c index 99ec72e..a17d994 100644 --- a/unix/setpgid.c +++ b/unix/setpgid.c @@ -15,7 +15,7 @@ #include "lib.h" -int __bsd_setpgrp (int, int); +__typeof__(setpgid) __setpgid; int __setpgid (pid_t pid, pid_t pgid) diff --git a/unix/setpgrp.c b/unix/setpgrp.c index a48808f..431ddd9 100644 --- a/unix/setpgrp.c +++ b/unix/setpgrp.c @@ -11,31 +11,11 @@ #include #include #include -#include #include "lib.h" int __setpgrp (void) { - static short have_pgrp = 1; - - if (have_pgrp) { - int r = 0; - - r = Psetpgrp (0, 0); - if (r == -ENOSYS) { - have_pgrp = 0; - } - else if (r < 0) { - if (r == -ENOENT) - r = -ESRCH; - else if (r == -EACCES) - r = -EPERM; - __set_errno (-r); - return -1; - } - } - - return 0; + return __bsd_setpgrp (0, 0); } weak_alias (__setpgrp, setpgrp)