getutxent() — Read next entry in utmpx database
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <utmpx.h>
struct utmpx *getutxent(void);
General description
The getutxent() function reads in the next entry from the utmpx database. If the database is not already open, it opens it. If it reaches the end of the database, it fails.
The pututxline() function obtains an exclusive lock in the utmpx database on the byte range of the record which is ready to write and releases the lock before returning to its caller. The functions getutxent(), getutxid(), and getutxline() might continue to read and are not affected by pututxline().
Because the getutxent() function returns thread-specific data the getutxent() function can be used safely from a multithreaded application. If multiple threads in the same process open the database, then each thread opens the database with a different file descriptor. The thread's database file descriptor is closed when the calling thread terminates or the endutxent() function is called by the calling thread.
The name of the database file defaults to /etc/utmpx. To process a different database file name use the __utmpxname() function.
- EMPTY
- No other members have meaningful data.
- BOOT_TIME
- ut_tv is meaningful.
- __RUN_LVL
- ut_tv and ut_line are meaningful
- OLD_TIME
- ut_tv is meaningful.
- NEW_TIME
- ut_tv is meaningful.
- USER_PROCESS
- ut_id, ut_user (login name of the user), ut_line, ut_pid, and ut_tv are meaningful.
- INIT_PROCESS
- ut_id, ut_pid, and ut_tv are meaningful.
- LOGIN_PROCESS
- ut_id, ut_user (implementation-specific name of the login process), ut_pid, and ut_tv are meaningful.
- DEAD_PROCESS
- ut_id, ut_pid, and ut_tv are meaningful.
Returned value
If successful, getutxent() returns a pointer to a utmpx structure containing a copy of the requested entry in the user accounting database.
If unsuccessful, getutxent() returns a NULL pointer.
No errors are defined for this function.