Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

exit(2)

fork(2)

getpid(2)

kill(2)

signal(2)

termio(7)

SETPGRP(2)  —  HP-UX

NAME

setpgrp, setpgrp2 − set process group ID

SYNOPSIS

int setpgrp ()

int setpgrp2 (pid, pgrp)
int pid, pgrp;

DESCRIPTION

Setpgrp sets the process group ID of the calling process to the process ID of the calling process and returns the new process group ID. 

Setpgrp breaks the calling process’s terminal affiliation unless it is already the process group leader, see termio(7). Setpgrp enables the sending of SIGHUP upon process group leader termination, see exit(2).

Setpgrp2 sets the process group ID of the process specified by pid to be pgrp. If pid is zero, the process group ID of the current process will be affected. 

The following condition must be met for setpgrp2 to succeed; otherwise, the error [EINVAL] is returned:

The value of pgrp must be in the range of valid process group ID values, or it must be zero ("no process group"). 

In addition, one or more of the following conditions must be met for setpgrp2 to succeed; otherwise, the error [EPERM] is returned:

The effective user ID of the current process is super-user. 

The affected process is a descendant of the current process. 

The real or effective user ID of the current process matches the real or saved user ID of the affected process. 

In addition, one or more of the following conditions must be met for setpgrp2 to succeed, otherwise, the error [EPERM] is returned:

The effective user ID of the current process is super-user. 

The value of pgrp matches the saved process group ID of the current process. 

All processes with a process ID or process group ID that is the same as pgrp have the same real or saved user ID as the real or effective user ID of the current process, or are descendants of the current process. 

Setpgrp2 does not affect the process’ terminal affiliation, but does affect whether the process is in the distinguished process group of the terminal, see termio(7). Setpgrp2 disables the sending of SIGHUP upon process group leader termination, see exit(2).

ERRORS

Setpgrp2 will fail and no change will occur if any of the following are true:

[ESRCH] No process can be found corresponding to that specified by pid.

[EPERM] The effective user ID of the current process is not super-user; and the real or effective user ID of the current process does not match the real or saved user ID of the specified process; and the specified processes are not descendants of the current process. 

[EPERM] The effective user ID of the current process is not super-user; and the value pgrp does not match the saved process group ID of calling process; and a process exists that is not a descendant of the calling process and whose process ID or process group ID match pgrp, while neither the real or saved user ID of this process match either the real or effective user ID of the calling process.

[EINVAL] The value for pgrp is outside the range of valid process group ID values and is non-zero. 

RETURN VALUE

Setpgrp returns the value of the new process group ID. 

Upon successful completion, setpgrp2 returns zero.  Otherwise, a value of -1 is returned and errno is set to indicate the error. 

DEPENDENCIES

Series 300, 500
Setpgrp2 is not supported. 

AUTHOR

Setpgrp and setpgrp2 were developed by HP, AT&T, and the University of California, Berkeley. 

SEE ALSO

exec(2), exit(2), fork(2), getpid(2), kill(2), signal(2), termio(7). 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026