NAME
setregid - set real and effective group ID

The real and effective group ID's of the current process are set to the arguments. Unprivileged users may change the real group ID to the effective group ID and vice-versa; only the super-user may make other changes. Supplying a value of -1 for either the real or effective group ID forces the system to substitute the current ID in place of the -1 parameter. is done BSD-style, with no consideration of the saved gid, except that if you set the effective gid, it sets the saved gid too. This makes it possible for a setgid program to completely drop its privileges, which is often a useful assertion to make when you are doing a security audit over a program. The general idea is that a program which uses just will be 100% compatible with BSD. A program which uses just will be 100% compatible with POSIX w/ Saved ID's. On success, zero is returned. On error, -1 is returned, and is set appropriately. The current process is not the super-user and a change other than changing the effective group-id to the real group-id was specified. The function call appeared in BSD 4.2. BSD 4.3