ENDUTXENT(3) BSD Library Functions Manual ENDUTXENT(3)
NAME
endutxent, getutxent, getutxid, getutxline, pututxline, setutxent -- user
accounting database functions
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
##include <>
void
endutxent(void);
struct utmpx *
getutxent(void);
struct utmpx *
getutxid(const struct utmpx *);
struct utmpx *
getutxline(const struct utmpx *);
struct utmpx *
pututxline(const struct utmpx *);
void
setutxent(void);
DESCRIPTION
These functions provide access to the utmpx(5) user accounting database.
getutxent() reads the next entry from the database; if the database was
not yet open, it also opens it. setutxent() resets the database, so that
the next getutxent() call will get the first entry. endutxent() closes
the database.
getutxid() returns the next entry of the type specified in its argument's
uttype field, or NUL if none is found. getutxline() returns the next
LOGINPROCES or USERPROCES entry which has the same name as specified
in the utline field, or NUL if no match is found.
pututxline() adds the argument utmpx(5) entry line to the accounting
database, replacing a previous entry for the same user if it exists.
The utmpx structure
The utmpx structure has the following definition:
struct utmpx {
char utuser[UTXUSERSIZE]; /* login name */
char utid[UTXIDSIZE]; /* id */
char utline[UTXLINESIZE]; /* tty name */
pidt utpid; /* process id creating the entry */
short uttype; /* type of this entry */
struct timeval uttv; /* time entry was created */
char uthost[UTXHOSTSIZE]; /* host name */
uint32t utpad[16]; /* reserved for future use */
};
Valid entries for uttype are:
BOTIME Time of a system boot.
DEADPROCES A session leader exited.
EMPTY No valid user accounting information.
INITPROCES A process spawned by init(8).
LOGINPROCES The session leader of a logged-in user.
NEWTIME Time after system clock change.
OLDTIME Time before system clock change.
RUNLVL Run level. Provided for compatibility, not used.
USERPROCES A user process.
RETURN VALUES
getutxent() returns the next entry, or NUL on failure (end of database
or problems reading from the database). getutxid() and getutxline()
return the matching structure on success, or NUL if no match was found.
pututxline() returns the structure that was successfully written, or
NUL.
SEE ALSO
utmpx(5)
STANDARDS
The endutxent(), getutxent(), getutxid(), getutxline(), pututxline(),
setutxent() all conform to IE Std 1003.1-2001 (``POSIX.1'') (XSI exten-
sion), and previously to X/Open Portability Guide Issue 4, Version 2
(``XPG4.2''). The fields utuser, utid, utline, utpid, uttype, and
uttv conform to IE Std 1003.1-2001 (``POSIX.1'') (XSI extension), and
previously to X/Open Portability Guide Issue 4, Version 2 (``XPG4.2'').
BSD July 13, 2004 BSD
|