utmpname()

Updated: April 19, 2023

Specify a different user information file

Synopsis:

#include <utmp.h>

int utmpname( const char * filename );

Arguments:

filename
The name of the file that you want to use.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The utmpname() function lets you specify the name of the user information file to examine. You can change the stored name from the default file (defined in _PATH_UTMP) to any other file.

Note that this function doesn't open the new file—it just closes the old file if it's currently open and saves the new filename. If the new file doesn't exist, this won't be apparent until the first attempt to reference it is made.

Returns:

0 on success, -1 on failure (errno is set).

Errors:

ENOMEM
There's insufficient memory to store the new name.

Files:

_PATH_UTMP
Specifies the default user information file.

Classification:

Unix

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread No