Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <utmpx.h>
struct utmpx *getutxent(void);
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.
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.