getutx.3c (2010 09)
g
getutx(3C) getutx(3C)
NAME
getutx: endutxent(), getutxent(), getutxid(), getutxline(), pututxline(), setutxent() - access utmpx file entry
SYNOPSIS
#include <utmpx.h>
struct utmpx *getutxent(void);
struct utmpx *getutxid(const struct utmpx *id);
struct utmpx *getutxline(const struct utmpx *line);
struct utmpx *pututxline(const struct utmpx *utmpx);
void setutxent(void);
void endutxent(void);
Remarks:
The ut_addr field in the utmpx structure is deprecated and will be obsoleted and removed in a
future release. If this field is needed, use the
getuts() functions (see getuts (3C)).
DESCRIPTION
getutxent(), getutxid(), and getutxline() each return a pointer to a structure of the follow-
ing type:
struct utmpx {
char ut_user[24]; /* User login name */
char ut_id[4]; /* /etc/inittab id (usually line #) */
char ut_line[12]; /* device name (console, lnxx) */
pid_t ut_pid; /* process id */
short ut_type; /* type of entry */
struct __exit_status {
short __e_termination; /* Process termination status */
short __e_exit; /* Process exit status */
} ut_exit; /* The exit status of a process */
/* marked as DEAD_PROCESS. */
unsigned short ut_reserved1; /* Reserved for future use */
struct timeval {
time_t tv_sec; /* seconds */
long tv_usec; /* and microseconds */
} ut_tv; /* time entry was made */
char ut_host[64]; /* host name, if remote; NOT SUPPORTED */
unsigned long ut_addr; /* Internet addr of host, if remote; */
/* TO BE OBSOLETED */
char ut_reserved2[12] ; /* Reserved for future use */
};
getutxent() Reads in the next entry from a utmpx-like file. If the file is not already open,
getutxent() opens it. If it reaches the end of the file, getutxent() fails.
getutxid() Searches forward from the current point in the utmpx file until it finds an entry
with a ut_type matching id− >ut_type if the type specified is RUN_LVL,
BOOT_TIME, OLD_TIME,orNEW_TIME. If the type specified in id is
INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS,orDEAD_PROCESS,
getutxid() returns a pointer to the first entry whose type is one of these four,
and whose ut_id field matches id−>ut_id . If end-of-file is reached without a
match, getutxid() fails.
getutxline() Searches forward from the current point in the utmpx file until it finds an entry of
type LOGIN_PROCESS or USER_PROCESS that also has a ut_line string
matching the line − >ut_line string. If end-of-file is reached without a match,
getutxline() fails.
pututxline() Writes out the supplied utmpx structure into the utmpx file, translates the sup-
plied utmpx structure into a utmp structure and writes it to a utmp file.
pututxline() uses getutxid() to search forward for the proper location if it
is not already there. It is normally expected that the application program has
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1