Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

cuserid(3) Guardian Native C Library Calls Reference Manual
NAME
cuserid - Gets the username associated with the real user ID of the current process
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZSECSRL
G-series native OSS processes: /G/system/sysnn/zsecsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZSECDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zsecdll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ysecdll
SYNOPSIS
#include <stdio.h>
char *cuserid(
char *s);
PARAMETERS
s Species where to store the character string containing the username.
If the s parameter is a null pointer, the character string is stored into an internal
static buffer and the address of the buffer is returned. This internal static buffer is
overwritten with the next call to cuserid().
If the s parameter is not a null pointer, the character string is stored into the array
pointed to by the s parameter. This array must contain at least L_cuserid bytes.
L_cuserid is defined in the stdio.h header file.
DESCRIPTION
The cuserid() function returns a character string that represents the username associated with the
real user ID of the current process. HP implements this function as getpwuid(getuid).
The real user ID of the process is the user ID associated with the login username, unless a pro-
cess with appropriate privileges has changed it.
If an alias was used for login and the real user ID of the process has not been changed, this user-
name is the alias. If an alias was used for login and the real user ID of the process has been
changed, this username is the username associated with the new real user ID.
The cuserid() function can be called only by native processes.
RETURN VALUES
If the s parameter is not a null pointer, the cuserid() function returns the username as a string
array in s. If the s parameter is not a null pointer and the username cannot be found, a string con-
sisting of a null terminator is returned.
If the s parameter is a null pointer and the username cannot be found, the cuserid() function
returns a null pointer.
If the username cannot be found, a null string is stored into the s array.
If an error occurs, the cuserid() function returns a null pointer and sets errno to indicate the
specific error.
ERRORS
If any of the following conditions occurs, the cuserid() function sets errno to the corresponding
value:
[EAGAIN] A system resource is temporarily unavailable. The function cannot allocate
sufficient heap space to complete the call.
1154 Hewlett-Packard Company 527192-018