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

NAME

6       endutxent,  getutxent,  getutxid,  getutxline,  pututxline, setutxent -
7       user accounting database functions
8

SYNOPSIS

10       #include <utmpx.h>
11
12       void endutxent(void);
13       struct utmpx *getutxent(void);
14       struct utmpx *getutxid(const struct utmpx *id);
15       struct utmpx *getutxline(const struct utmpx *line);
16       struct utmpx *pututxline(const struct utmpx *utmpx);
17       void setutxent(void);
18
19

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

121       None.
122

APPLICATION USAGE

124       The  sizes of the arrays in the structure can be found using the sizeof
125       operator.
126

RATIONALE

128       None.
129

FUTURE DIRECTIONS

131       None.
132

SEE ALSO

134       The Base Definitions volume of IEEE Std 1003.1-2001, <utmpx.h>
135
137       Portions of this text are reprinted and reproduced in  electronic  form
138       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
139       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
140       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
141       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
142       event of any discrepancy between this version and the original IEEE and
143       The Open Group Standard, the original IEEE and The Open Group  Standard
144       is  the  referee document. The original Standard can be obtained online
145       at http://www.opengroup.org/unix/online.html .
146
147
148
149IEEE/The Open Group                  2003                         ENDUTXENT(P)
Impressum