Go to the previous, next section.
pid_t getpgrp(void);
int setpgid(pid_t pid, pid_t pgid);
int setpgrp(void);
pid: [in] the task to modify (0 for the current task).
pgid: [in] the new process group id. If zero is specified, the value of pid is taken.
getpgrp
returns the current process group. setpgid
sets
the process group id of the task specified by pid to pgid.
setpgrp
sets the group id of the current task to its process id.
Note: setpgrp
is implemented as setpgid(0,0)
.
getpgrp allways succeed and returns the current process group id.
On success, setpgrp
and setgpid
return zero. On error,
they return -1 and errno
is set to one of the following values:
For setpgid:
EINVAL
: pgid is less than 0.
ESRCH
.
For both calls: EPERM
.
Go to the previous, next section.