setgid function

void setgid(
  1. int gid
)

Set the group ID of the calling process to GID. If the calling process is the super-user, set the real and effective group IDs, and the saved set-group-ID to GID; if not, the effective group ID is set to GID. Throws PosixException if the operation fails.

Implementation

void setgid(
  int gid,
) {
  _setgid ??= Libc()
      .dylib
      .lookupFunction<ffi.Int32 Function(ffi.Uint32), _dart_setgid>('setgid');
  final result = _setgid!(
    gid,
  );

  _throwIfErrno('setregid', result);
}