Go to the previous, next section.

getpgrp, setpgid and setpgrp

SYNOPSIS

pid_t getpgrp(void);

int setpgid(pid_t pid, pid_t pgid);

int setpgrp(void);

PARAMETERS

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.

DESCRIPTION

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).

RETURN VALUE

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:

For both calls: EPERM.

Go to the previous, next section.