diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/Makefile | 2 | ||||
-rw-r--r-- | posix/setpgrp.c | 25 | ||||
-rw-r--r-- | posix/unistd.h | 26 |
3 files changed, 49 insertions, 4 deletions
diff --git a/posix/Makefile b/posix/Makefile index fef141509d..052c17c21c 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -37,7 +37,7 @@ routines := \ execve fexecve execv execle execl execvp execlp \ getpid getppid \ getuid geteuid getgid getegid getgroups setuid setgid group_member \ - getpgid setpgid getpgrp getsid setsid \ + getpgid setpgid getpgrp setpgrp getsid setsid \ getlogin setlogin \ pathconf sysconf fpathconf \ glob fnmatch regex \ diff --git a/posix/setpgrp.c b/posix/setpgrp.c new file mode 100644 index 0000000000..56102a3c26 --- /dev/null +++ b/posix/setpgrp.c @@ -0,0 +1,25 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include <unistd.h> + +int +setpgrp () +{ + return setpgid (0, 0); +} diff --git a/posix/unistd.h b/posix/unistd.h index 516f288f64..2ac0b2f172 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -339,10 +339,30 @@ extern __pid_t __getpgid __P ((__pid_t __pid)); extern __pid_t getpgid __P ((__pid_t __pid)); #endif -#ifdef __USE_BSD -/* Another name for `setpgid'. */ +#if defined (__USE_SVID) || defined (__USE_BSD) +/* Both System V and BSD have `setpgrp' functions, but with different + calling conventions. The BSD function is the same as POSIX.1 `setpgid' + (above). The System V function takes no arguments and puts the calling + process in its on group like `setpgid (0, 0)'. + + New programs should always use `setpgid' instead. + + The default in GNU is to provide the System V function. The BSD + function is available under -D_BSD_SOURCE with -lbsd-compat. */ + +#ifndef __FAVOR_BSD + +/* Set the process group ID of the calling process to its own PID. + This is exactly the same as `setpgid (0, 0)'. */ +extern int setpgrp __P ((void)); + +#else + +/* Another name for `setpgid' (above). */ extern int setpgrp __P ((__pid_t __pid, __pid_t __pgrp)); -#endif /* Use BSD. */ + +#endif /* Favor BSD. */ +#endif /* Use SVID or BSD. */ /* Create a new session with the calling process as its leader. The process group IDs of the session and the calling process |