1getutxent(3C) Standard C Library Functions getutxent(3C)
2
3
4
6 getutxent, getutxid, getutxline, pututxline, setutxent, endutxent, utm‐
7 pxname, getutmp, getutmpx, updwtmp, updwtmpx - user accounting database
8 functions
9
11 #include <utmpx.h>
12
13 struct utmpx *getutxent(void);
14
15
16 struct utmpx *getutxid(const struct utmpx *id);
17
18
19 struct utmpx *getutxline(const struct utmpx *line);
20
21
22 struct utmpx *pututxline(const struct utmpx *utmpx);
23
24
25 void setutxent(void);
26
27
28 void endutxent(void);
29
30
31 int utmpxname(const char *file);
32
33
34 void getutmp(struct utmpx *utmpx, struct utmp *utmp);
35
36
37 void getutmpx(struct utmp *utmp, struct utmpx *utmpx);
38
39
40 void updwtmp(char *wfile, struct utmp *utmp);
41
42
43 void updwtmpx(char *wfilex, struct utmpx *utmpx);
44
45
47 These functions provide access to the user accounting database, utmpx
48 (see utmpx(4)). Entries in the database are described by the defini‐
49 tions and data structures in <utmpx.h>.
50
51
52 The utmpx structure contains the following members:
53
54 char ut_user[32]; /* user login name */
55 char ut_id[4]; /* /etc/inittab id */
56 /* (usually line #) */
57 char ut_line[32]; /* device name */
58 /* (console, lnxx) */
59 pid_t ut_pid; /* process id */
60 short ut_type; /* type of entry */
61 struct exit_status ut_exit; /* exit status of a process */
62 /* marked as DEAD_PROCESS */
63 struct timeval ut_tv; /* time entry was made */
64 int ut_session; /* session ID, used for */
65 /* windowing */
66 short ut_syslen; /* significant length of */
67 /* ut_host */
68 /* including terminating null */
69 char ut_host[257]; /* host name, if remote */
70
71
72
73 The exit_status structure includes the following members:
74
75 short e_termination; /* termination status */
76 short e_exit; /* exit status */
77
78
79 getutxent()
80 The getutxent() function reads in the next entry from a utmpx database.
81 If the database is not already open, it opens it. If it reaches the end
82 of the database, it fails.
83
84 getutxid()
85 The getutxid() function searches forward from the current point in the
86 utmpx database until it finds an entry with a ut_type matching
87 id->ut_type, if the type specified is RUN_LVL, BOOT_TIME, DOWN_TIME,
88 OLD_TIME, or NEW_TIME. If the type specified in id is INIT_PROCESS,
89 LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS, then getutxid() will
90 return a pointer to the first entry whose type is one of these four and
91 whose ut_id member matches id->ut_id. If the end of database is reached
92 without a match, it fails.
93
94 getutxline()
9