HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)

g
getuts(3C) getuts(3C)
NAME
getuts: getutsent(), getutsid(), getutsline(), pututsline(), setutsent(), endutsent() - access/update routines for
user-accounting database maintained by utmpd
SYNOPSIS
#include <utmps.h>
struct utmps * getutsent(size_t utmps_size):
struct utmps * getutsid(const struct utmps *id, size_t utmps_size):
struct utmps * getutsline(const struct utmps *line, size_t utmps_size):
struct utmps * pututsline(const struct utmps *utmps, size_t utmps_size):
struct utmps * getutspid( pid_t pid, size_t utmps_size):
void setutsent(void):
void endutsent(void):
Remarks
The size of the utmps structure (for example sizeof(struct utmps)
) is passed as utmps_size
parameter in the above calls.
A macro equivalent exists for each of the above function calls. These macros provide a shorthand way of
calling getuts(3C) functions, by implicitly passing the utmps_size parameter to the corresponding getuts(3C)
function.
struct utmps * GETUTSENT():
struct utmps * GETUTSID(const struct utmps *id):
struct utmps * GETUTSLINE(const struct utmps *line):
struct utmps * PUTUTSLINE(const struct utmps * utmps):
struct utmps * GETUTSPID( pid_t pid):
void SETUTSENT(void):
void ENDUTSENT(void):
DESCRIPTION
getutsent() , getutsid() , and getutsline() each return a pointer to a utmps structure, the
key elements of the utmps structure are
char ut_user[] User login name
char ut_id[] Unique Id to distinguish an entry
char ut_line[] Device name
pid_t ut_pid Process Id
short ut_type Type of Entry
struct ut_exit The exit status of a process
struct timeval ut_tv Time entry was made
char ut_host[] Host name, if remote
uint8_t ut_addr[] Internet Address of the Host,
if remote
short ut_addr_type Flag to identify type of address
in ut_addr
Routines
getutsent() This call returns the next record from the in-memory user accounting database
maintained by utmpd(1M). When the end of the utmpd’s database is reached
getutsent() fails and returns NULL. The macro GETUTSENT() is a wrapper
around getutsent() and implicitly passes the utmps_size parameter.
getutsid() For entries of ut_type matching INIT_PROCESS , LOGIN_PROCESS,
USER_PROCESS and DEAD_PROCESS , getutsid() searches the utmpd’s
database for an entry matching id->ut_id eld. The record is fetched irrespective
of the current position in the internal ordering and does not alter the current posi-
tion in the internal ordering for the getutsent() API.
HP-UX 11i Version 2: December 2007 Update 1 Hewlett-Packard Company 557