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

NAME

12       endutxent, getutxent, getutxid,  getutxline,  pututxline,  setutxent  -
13       user accounting database functions
14

SYNOPSIS

16       #include <utmpx.h>
17
18       void endutxent(void);
19       struct utmpx *getutxent(void);
20       struct utmpx *getutxid(const struct utmpx *id);
21       struct utmpx *getutxline(const struct utmpx *line);
22       struct utmpx *pututxline(const struct utmpx *utmpx);
23       void setutxent(void);
24
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 open
31       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 by
35       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              ut_type Member   Other Members with Meaningful Data
66
67              EMPTY            No others
68              BOOT_TIME        ut_tv
69              OLD_TIME         ut_tv
70              NEW_TIME         ut_tv
71              USER_PROCESS     ut_id, ut_user (login name of the user),
72                               ut_line, ut_pid, ut_tv
73              INIT_PROCESS     ut_id, ut_pid, ut_tv
74              LOGIN_PROCESS    ut_id, ut_user (implementation-defined
75                               name of the login process), ut_pid,
76                               ut_tv
77              DEAD_PROCESS     ut_id, ut_pid, ut_tv
78
79       An implementation that provides extended security controls  may  impose
80       implementation-defined  restrictions  on  accessing the user accounting
81       database. In particular, the system may deny the existence of  some  or
82       all of the user accounting database entries associated with users other
83       than the caller.
84
85       If the process has appropriate privileges,  the  pututxline()  function
86       shall  write  out  the  structure into the user accounting database. It
87       shall use getutxid() to search for a record that satisfies the request.
88       If this search succeeds, then the entry shall be replaced. Otherwise, a
89       new entry shall be made at the end of the user accounting 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 reentrant. A function that is not  required
98       to be reentrant is not required to be thread-safe.
99

RETURN VALUE

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

ERRORS

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

EXAMPLES

127       None.
128

APPLICATION USAGE

130       The sizes of the arrays in the structure can be found using the  sizeof
131       operator.
132

RATIONALE

134       None.
135

FUTURE DIRECTIONS

137       None.
138

SEE ALSO

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