HP 3000 Manuals

setuid [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

setuid 

Sets user IDs.

Syntax 

     #include <sys/types.h>
     init setuid(uid_t uid);

Parameters 

uid                   The ID of a user.

Return Values 

Upon successful completion, a value of zero is returned.  If
unsuccessful, a value of -1 is returned and errno is set to indicate the
error.

Description 

If {_POSIX_SAVED_IDS} is defined:

If the process has appropriate privileges, the setuid() function sets the
real user ID, effective user ID, and the saved set-user-ID to uid.

If the process does not have appropriate privileges, but uid is equal to
the real user ID or the saved set-user-ID , the setuid() function sets
the effective user ID to uid; the real user ID and saved set-user-ID
remain unchanged by this functioncall.

Otherwise:

If the process has appropriate privileges, the setuid() function sets the
real user ID and effective user ID to uid.

If the process does not have appropriate privileges, but uid is equal to
the real user ID, the setuid() function sets the effective user ID to
uid; the real user ID remains unchanged by this function call.

If the process does not have appropriate privileges, but gid is equal to
the real group ID, the setgid() functionsets the effective group ID to
gid; the real group ID remains unchanged by this function call.

Implementation Considerations 

None.

Errors 

If any of the following conditions occur, the setuid() function shall
return -1 and set errno to the corresponding value:

EINVAL            CAUSE           The signal sig is not a valid signal number, or pid 
                                  is -1.
                  ACTION          Refer to Table 3-5  for descriptions of valid
                                  signal numbers, or set pid to a valid value.

EPERM             CAUSE           The caller does not have permission to send the
                                  signal to any receiving process.
                  ACTION          Refer to the kill() function description for signal
                                  permission rules.

If any of the following conditions occur, the setgid() function shall
return -1 and set errno to the corresponding value:

EINVAL            CAUSE           The signal sig is not a valid signal number, or pid 
                                  is -1.
                  ACTION          Refer to Table 3-5  for descriptions of valid
                                  signal numbers, or set pid to a valid value.

EPERM             CAUSE           The caller does not have permission to send the
                                  signal to any receiving process.
                  ACTION          Refer to the kill() function description for signal
                                  permission rules.

See Also 

exec(), getuid(), POSIX.1 (Section 3.3.2).



MPE/iX 5.0 Documentation