1 .\" Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .Nd read user login records
41 .Ft struct ulog_utmpx *
42 .Fn ulog_getutxent "void"
43 .Ft struct ulog_utmpx *
44 .Fn ulog_getutxline "const struct ulog_utmpx *line"
45 .Ft struct ulog_utmpx *
46 .Fn ulog_pututxline "const struct ulog_utmpx *utmpx"
48 .Fn ulog_setutxent "void"
50 .Fn ulog_endutxent "void"
54 function returns a pointer to an object, with the following structure,
55 containing stored information of an active user login session.
58 char ut_user[]; /* Username. */
59 char ut_id[]; /* Private data. */
60 char ut_line[]; /* TTY device. */
61 char ut_host[]; /* Remote hostname. */
62 pid_t ut_pid; /* Process identifier. */
63 short ut_type; /* Type of entry. */
64 struct timeval ut_tv; /* Timestamp. */
68 The fields are as follows:
69 .Bl -tag -width ut_user
71 The username of the logged in user.
73 Private data that can be used to later identify the record.
74 This implementation is not capable of storing this value on disk.
76 The pathname of the TTY device, without the leading
80 An optional hostname of a remote system, if the login session is
81 provided through a networked login service.
83 Process identifier of the session leader of the login session.
84 This implementation is not capable of storing this value on disk.
88 field contains the type of the message, which may have one of the
90 .Bl -tag -width SHUTDOWN_TIME
92 No valid user accounting information.
94 Identifies time of system boot.
96 Identifies time when system clock changed.
98 Identifies time after system clock changed.
100 Identifies a process.
102 Identifies a process spawned by the init process.
104 Identifies the session leader of a logged-in user.
106 Identifies a session leader who has exited.
108 Identifies time when system was shut down.
111 Timestamp indicating when the entry was last modified.
114 This implementation guarantees all strings returned in the structure to
119 function reads the next entry from the utmp file, opening the file if
123 function reads entries from the utmp file, until finding an entry which
130 opens the file, closing it first if already opened.
133 function closes any open files.
139 functions read from the beginning of the file until and EOF is
144 function writes a new entry to the file.
150 functions return a null pointer on EOF or error.
153 .Xr ulog_setutxfile 3 ,
156 This interface is similar to
161 The underlying file format does not allow a correctly behaving
162 implementation of the standardized interface.
164 This programming interface has been designed to ease the migration
168 .Dv _ULOG_POSIX_NAMES
169 is set before inclusion of
171 it is also possible to use the
182 These functions appeared in