1ENDUTXENT(3P)              POSIX Programmer's Manual             ENDUTXENT(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       endutxent, getutxent, getutxid,  getutxline,  pututxline,  setutxent  —
14       user accounting database functions
15

SYNOPSIS

17       #include <utmpx.h>
18
19       void endutxent(void);
20       struct utmpx *getutxent(void);
21       struct utmpx *getutxid(const struct utmpx *id);
22       struct utmpx *getutxline(const struct utmpx *line);
23       struct utmpx *pututxline(const struct utmpx *utmpx);
24       void setutxent(void);
25

DESCRIPTION

27       These functions shall provide access to the user accounting database.
28
29       The  getutxent()  function  shall  read  the  next  entry from the user
30       accounting database.  If the database is not  already  open,  it  shall
31       open it. If it reaches the end of the database, it shall fail.
32
33       The  getutxid() function shall search forward from the current point in
34       the database.  If the ut_type value of the utmpx structure  pointed  to
35       by  id  is BOOT_TIME, OLD_TIME, or NEW_TIME, then it shall stop when it
36       finds an entry with a matching ut_type value. If the ut_type  value  is
37       INIT_PROCESS,  LOGIN_PROCESS,  USER_PROCESS,  or  DEAD_PROCESS, then it
38       shall stop when it finds an entry whose type is one of these  four  and
39       whose  ut_id  member  matches  the  ut_id member of the utmpx structure
40       pointed to by id.  If the end of the  database  is  reached  without  a
41       match, getutxid() shall fail.
42
43       The  getutxline()  function shall search forward from the current point
44       in the database until it finds an entry of the  type  LOGIN_PROCESS  or
45       USER_PROCESS  which also has a ut_line value matching that in the utmpx
46       structure pointed to by line.  If the end of the  database  is  reached
47       without a match, getutxline() shall fail.
48
49       The  getutxid()  or getutxline() function may cache data. For this rea‐
50       son, to use getutxline() to search for multiple occurrences, the appli‐
51       cation  shall  zero  out the static data after each success, or getutx‐
52       line() may return a pointer to the same utmpx structure.
53
54       There is one exception to the rule about clearing the structure  before
55       further  reads  are done. The implicit read done by pututxline() (if it
56       finds that it is not already at the correct place in the user  account‐
57       ing database) shall not modify the static structure returned by getutx‐
58       ent(), getutxid(), or getutxline(), if  the  application  has  modified
59       this structure and passed the pointer back to pututxline().
60
61       For  all entries that match a request, the ut_type member indicates the
62       type of the entry. Other members of the entry shall contain  meaningful
63       data based on the value of the ut_type member as follows:
64
65  ┌───────────────┬─────────────────────────────────────────────────────────────────┐
66ut_type Member Other Members with Meaningful Data                
67  ├───────────────┼─────────────────────────────────────────────────────────────────┤
68  │EMPTY          │ No others                                                       │
69  │BOOT_TIME      │ ut_tv
70  │OLD_TIME       │ ut_tv
71  │NEW_TIME       │ ut_tv
72  │USER_PROCESS   │ ut_id, ut_user (login name of the user), ut_line, ut_pid, ut_tv
73  │INIT_PROCESS   │ ut_id, ut_pid, ut_tv
74  │LOGIN_PROCESS  │ ut_id,   ut_user  (implementation-defined  name  of  the  login │
75  │               │ process), ut_line, ut_pid, ut_tv
76  │DEAD_PROCESS   │ ut_id, ut_pid, ut_tv
77  └───────────────┴─────────────────────────────────────────────────────────────────┘
78       An implementation that provides extended security controls  may  impose
79       implementation-defined  restrictions  on  accessing the user accounting
80       database. In particular, the system may deny the existence of  some  or
81       all of the user accounting database entries associated with users other
82       than the caller.
83
84       If the process has appropriate privileges,  the  pututxline()  function
85       shall  write  out  the  structure into the user accounting database. It
86       shall search for a record  as  if  by  getutxid()  that  satisfies  the
87       request.  If  this  search  succeeds, then the entry shall be replaced.
88       Otherwise, a new entry shall be made at the end of the user  accounting
89       database.
90
91       The endutxent() function shall close the user accounting database.
92
93       The  setutxent() function shall reset the input to the beginning of the
94       database. This should be done before each search for a new entry if  it
95       is desired that the entire database be examined.
96
97       These functions need not be thread-safe.
98

RETURN VALUE

100       Upon  successful  completion, getutxent(), getutxid(), and getutxline()
101       shall return a pointer to a utmpx structure containing a  copy  of  the
102       requested  entry  in  the  user  accounting database. Otherwise, a null
103       pointer shall be returned.
104
105       The return value may point to a static area which is overwritten  by  a
106       subsequent call to getutxid() or getutxline().
107
108       Upon  successful  completion,  pututxline() shall return a pointer to a
109       utmpx structure containing a copy  of  the  entry  added  to  the  user
110       accounting database. Otherwise, a null pointer shall be returned.
111
112       The endutxent() and setutxent() functions shall not return a value.
113

ERRORS

115       No  errors  are  defined  for the endutxent(), getutxent(), getutxid(),
116       getutxline(), and setutxent() functions.
117
118       The pututxline() function may fail if:
119
120       EPERM  The process does not have appropriate privileges.
121
122       The following sections are informative.
123

EXAMPLES

125       None.
126

APPLICATION USAGE

128       The sizes of the arrays in the structure can be found using the  sizeof
129       operator.
130

RATIONALE

132       None.
133

FUTURE DIRECTIONS

135       None.
136

SEE ALSO

138       The Base Definitions volume of POSIX.1‐2008, <utmpx.h>
139
141       Portions  of  this text are reprinted and reproduced in electronic form
142       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
143       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
144       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
145       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
146       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
147       event of any discrepancy between this version and the original IEEE and
148       The Open Group Standard, the original IEEE and The Open Group  Standard
149       is  the  referee document. The original Standard can be obtained online
150       at http://www.unix.org/online.html .
151
152       Any typographical or formatting errors that appear  in  this  page  are
153       most likely to have been introduced during the conversion of the source
154       files to man page format. To report such errors,  see  https://www.ker
155       nel.org/doc/man-pages/reporting_bugs.html .
156
157
158
159IEEE/The Open Group                  2013                        ENDUTXENT(3P)
Impressum