setregid()

set real and effective group IDs for process 

Function


SYNOPSIS

#include <unistd.h>

int setregid(gid_t rgid, gid_t egid);


DESCRIPTION

The setregid() function sets the real and effective group IDs for the calling process.

When the first NuTCRACKER Platform process is executed in a new process group, the real user and group IDs, effective user and group IDs, and saved user and group IDs of the process are set based on the process token.

When a NuTCRACKER Platform process calls one of the exec() functions to execute a file (program), effective user and group IDs and saved user and group IDs are inherited by the new process if it is a NuTCRACKER Platform application.


PARAMETERS

rgid 

Is the new real group ID. If this is -1, then the real group ID is not changed.

egid 

Is the new effective group ID. If this is -1, then the effective group ID is not changed.


RETURN VALUES

If successful, setregid() returns a value of zero. On failure, it returns -1 and sets errno to one of the following values:

EINVAL 

The value of rgid or egid is out of range.

EPERM 

The process does not have appropriate privileges (the effective user ID is not 0) and rgid and egid do not match the real group ID or the saved group ID.


CONFORMANCE

UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The 8.1/2012R2/10/2016/2019/11/2022 security model is significantly different from the UNIX security model. The NuTCRACKER Platform mapping of the UNIX security model to Windows, and vice-versa, is discussed in detail under Security in the Windows Concepts chapter of the PTC MKS Toolkit UNIX to Windows Porting Guide.

On 8.1/2012R2/10/2016/2019/11/2022, the Administrator and System accounts are mapped to uid 0; only these accounts have permission to execute setregid().


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_NutForkExecl(), _NutForkExecle(), _NutForkExeclp(), _NutForkExeclpe(), _NutForkExecv(), _NutForkExecve(), _NutForkExecvp(), _NutForkExecvpe(), execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), getegid(), geteuid(), getgid(), getuid(), setgid(), setreuid(), setuid()


PTC MKS Toolkit 10.4 Documentation Build 39.