posix_spawnattr_getpgroup or posix_spawnattr_setpgroup Subroutine

Purpose

Gets and sets the spawn-pgroup attribute of a spawn attributes object.

Syntax

#include <spawn.h>

int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr,
       pid_t *restrict pgroup);
int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup);

Description

The posix_spawnattr_getpgroup subroutine gets the value of the spawn-pgroup attribute from the attributes object referenced by attr.

The posix_spawnattr_setpgroup subroutine sets the spawn-pgroup attribute in an initialized attributes object referenced by attr.

The spawn-pgroup attribute represents the process group to be joined by the new process image in a spawn operation (if POSIX_SPAWN_SETPGROUP is set in the spawn-flags attribute). The default value of this attribute is 0.

Return Values

Upon successful completion, the posix_spawnattr_getpgroup subroutine returns 0 and stores the value of the spawn-pgroup attribute of attr into the object referenced by the pgroup parameter; otherwise, an error number is returned to indicate the error.

Upon successful completion, the posix_spawnattr_setpgroup subroutine returns 0; otherwise, an error number is returned to indicate the error.

Error Codes

The posix_spawnattr_getpgroup and posix_spawnattr_setpgroup subroutines might fail if the following is true:
Item Description
EINVAL The value specified by attr is invalid.
The posix_spawnattr_setpgroup subroutine might fail if the following is true:
Item Description
EINVAL The value of the attribute being set is not valid.