[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

usrinfo Subroutine

Purpose

Gets and sets user information about the owner of the current process.

Library

Standard C Library (libc.a)

Syntax

#include <uinfo.h>


int usrinfo ( Command Buffer Count)
int Command;
char *Buffer;
int Count;

Description

The usrinfo subroutine gets and sets information about the owner of the current process. The information is a sequence of null-terminated name=value strings. The last string in the sequence is terminated by two successive null characters. A child process inherits the user information of the parent process.

Parameters

Command Specifies one of the following constants:
GETUINFO
Copies user information, up to the number of bytes specified by the Count parameter, into the buffer pointed to by the Buffer parameter.
SETUINFO
Sets the user information for the process to the number of bytes specified by the Count parameter in the buffer pointed to by the Buffer parameter. The calling process must have root user authority to set the user information.

The minimum user information consists of four strings typically set by the login program:

NAME=UserName
LOGIN=LoginName
LOGNAME=LoginName
TTY=TTYName

If the process has no terminal, the TTYName parameter should be null.

Buffer Specifies a pointer to a user buffer. This buffer is usually UINFOSIZ bytes long.
Count Specifies the number of bytes of user information copied from or to the user buffer.

Return Values

If successful, the usrinfo subroutine returns a non-negative integer giving the number of bytes transferred. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The usrinfo subroutine fails if one of the following is true:

EPERM The Command parameter is set to SETUINFO, and the calling process does not have root user authority.
EINVAL The Command parameter is not set to SETUINFO or GETUINFO.
EINVAL The Command parameter is set to SETUINFO, and the Count parameter is larger than UINFOSIZ.
EFAULT The Buffer parameter points outside of the address space of the process.

Related Information

The getuinfo subroutine, setpenv (setpenv Subroutine) subroutine.

The login command.

List of Security and Auditing Subroutines in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]