pxfsetuid

Date:

10-20-2011

NAME

PXFSETUID - Sets user ID

SYNOPSIS

INTEGER iuid, ierror
CALL PXFSETUID (iuid, ierror)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE Std 1003.9-1992 standard interface for FORTRAN 77

DESCRIPTION

The PXFSETUID routine uses the setuid(2) function to set the real user ID, effective user ID, and saved set user IDs of the calling process. The following conditions determine the setting of an ID. They are checked in the following order, and the first condition that is true is applied:

If the process has appropriate privilege, the real, effective, and saved set user IDs are all set to iuid.

If the ID is equal to either the real user ID, the effective user ID, or the saved set user, ID is set to iuid.

All arguments must be of default kind unless documented otherwise. Default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of valid arguments for this routine:

iuid

An input integer variable used to replace the current user ID for the calling process.

ierror

An output integer variable that contains zero if PXFSETUID was successful or nonzero if PXFSETUID was not successful.

This routine may return EINVAL if the value of the iuid argument is out of range. or EPERM if the process does not have the appropriate privileges and if iuid does not match the real user ID.

EXAMPLES

In this example, the current user ID for the current process will be obtained by calling PXFGETUID and then seting the user ID for the current process using the group ID returned by PXFGETUID.

program pxftest
integer iuid, ierror

CALL PXFGETUID(iuid, ierror)
   if (ierror .eq. 0) then
      CALL PXFSETUID(iuid, ierror)
      if (ierror .eq. 0) then
         print *,'user id set to ',iuid
      else
         print *,'user id not set to ',iuid,' because of error'
      endif
   else
      print *,'could not obtain user ID  error = ',ierror
   endif
end

SEE ALSO

setuid(2), PXFGETUID(3F)