Next: Logging In and Out, Previous: Manipulating the Database, Up: User Accounting Database
These functions, described in the X/Open Portability Guide, are declared in the header file utmpx.h.
The
utmpxdata structure contains at least the following members:On the GNU system,
short int ut_type- Specifies the type of login; one of
EMPTY,RUN_LVL,BOOT_TIME,OLD_TIME,NEW_TIME,INIT_PROCESS,LOGIN_PROCESS,USER_PROCESSorDEAD_PROCESS.pid_t ut_pid- The process ID number of the login process.
char ut_line[]- The device name of the tty (without /dev/).
char ut_id[]- The inittab ID of the process.
char ut_user[]- The user's login name.
struct timeval ut_tv- Time the entry was made. For entries of type
OLD_TIMEthis is the time when the system clock changed, and for entries of typeNEW_TIMEthis is the time the system clock was set to.struct utmpxis identical tostruct utmpexcept for the fact that including utmpx.h does not make visible the declaration ofstruct exit_status.
The following macros are defined for use as values for the
ut_type member of the utmpx structure. The values are
integer constants and are, on the GNU system, identical to the
definitions in utmp.h.
EMPTYRUN_LVLBOOT_TIMEOLD_TIMENEW_TIMEINIT_PROCESSLOGIN_PROCESSUSER_PROCESSDEAD_PROCESSThe size of the ut_line, ut_id and ut_user arrays
can be found using the sizeof operator.
This function is similar to
setutent. On the GNU system it is simply an alias forsetutent.
The
getutxentfunction is similar togetutent, but returns a pointer to astruct utmpxinstead ofstruct utmp. On the GNU system it simply is an alias forgetutent.
This function is similar to
endutent. On the GNU system it is simply an alias forendutent.
This function is similar to
getutid, but usesstruct utmpxinstead ofstruct utmp. On the GNU system it is simply an alias forgetutid.
This function is similar to
getutid, but usesstruct utmpxinstead ofstruct utmp. On the GNU system it is simply an alias forgetutline.
The
pututxlinefunction is functionally identical topututline, but usesstruct utmpxinstead ofstruct utmp. On the GNU system,pututxlineis simply an alias forpututline.
The
utmpxnamefunction is functionally identical toutmpname. On the GNU system,utmpxnameis simply an alias forutmpname.
You can translate between a traditional struct utmp and an XPG
struct utmpx with the following functions. On the GNU system,
these functions are merely copies, since the two structures are
identical.