1 .\" $NetBSD: endutxent.3,v 1.4 2004/05/04 02:38:35 atatat Exp $
3 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Thomas Klausner.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
30 .Dd September 10, 2019
42 .Nd user accounting database functions
52 .Fn getutxid "const struct utmpx *"
54 .Fn getutxline "const struct utmpx *"
56 .Fn getutxuser "const char *user"
58 .Fn pututxline "const struct utmpx *"
62 .Fn setutxdb "utx_db_t db" "const char *fname"
64 These functions provide access to the
68 user accounting database.
71 reads the next entry from the database;
72 if the database was not yet open, it also opens it.
74 resets the database, so that the next
76 call will get the first entry.
81 returns the next entry of the type specified in its argument's
91 entry which has the same name as specified in the
98 searches for the next entry in the database whose
110 entry line to the accounting database, replacing a previous entry for
111 the same user if it exists.
113 By default the aforementioned functions work on the default
115 database. The function
117 allows to change the database type being operated on, as well
118 as changing the path to that database.
125 and specifies which database to open. If
129 the default path for each of these is used as described in
133 Otherwise the path specified in
135 is used as the database.
136 .Ss The utmpx structure
139 structure has the following definition:
142 char ut_name[_UTX_USERSIZE]; /* login name */
143 char ut_id[_UTX_IDSIZE]; /* inittab id */
144 char ut_line[_UTX_LINESIZE]; /* tty name */
145 char ut_host[_UTX_HOSTSIZE]; /* host name */
146 uint16_t ut_session; /* session id used for windowing */
147 short ut_type; /* type of this entry */
148 pid_t ut_pid; /* process id creating the entry */
150 uint16_t e_termination; /* process termination signal */
151 uint16_t e_exit; /* process exit status */
153 struct sockaddr_storage ut_ss; /* address where entry was made from */
154 struct timeval ut_tv; /* time entry was created */
155 uint32_t ut_pad[10]; /* reserved for future use */
162 .Bl -tag -width LOGIN_PROCESSXX -compact -offset indent
164 Time of a system boot.
166 A session leader exited.
168 No valid user accounting information.
173 The session leader of a logged-in user.
175 Time after system clock change.
177 Time before system clock change.
180 Provided for compatibility, not used on
187 returns the next entry, or
189 on failure (end of database or problems reading from the database).
193 return the matching structure on success, or
195 if no match was found.
197 returns the structure that was successfully written, or
202 on success. Otherwise a negative value is returned and the global
205 is set to indicate the error.
220 (XSI extension), and previously to
232 (XSI extension), and previously to
242 .\" is for compatibility with
250 .\" files first appeared in