2 * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 #include <sys/cdefs.h>
33 #include <sys/_timeval.h>
34 #include <sys/_types.h>
36 #ifndef _PID_T_DECLARED
37 typedef __pid_t pid_t;
38 #define _PID_T_DECLARED
44 * This library is provided as a migratory tool towards <utmpx.h>. We
45 * cannot yet implement <utmpx.h>, because our on-disk file format lacks
46 * various fields. <utmpx.h> also has some shortcomings. Ideally we
47 * want to allow logging of user login records generated by unprivileged
48 * processes as well, provided that they hold a file descriptor to a
49 * pseudo-terminal master device.
51 * This library (or at least parts of it) will hopefully deprecate over
52 * time, when we provide the <utmpx.h> API.
57 char ut_id[8]; /* XXX: unsupported. */
60 pid_t ut_pid; /* XXX: unsupported. */
66 #define USER_PROCESS 4
67 #define INIT_PROCESS 5 /* XXX: unsupported. */
68 #define LOGIN_PROCESS 6 /* XXX: unsupported. */
69 #define DEAD_PROCESS 7
70 #define SHUTDOWN_TIME 8
76 void ulog_endutxent(void);
77 struct ulog_utmpx *ulog_getutxent(void);
79 struct ulog_utmpx *ulog_getutxid(const struct ulog_utmpx *);
81 struct ulog_utmpx *ulog_getutxline(const struct ulog_utmpx *);
82 struct ulog_utmpx *ulog_pututxline(const struct ulog_utmpx *);
83 void ulog_setutxent(void);
86 struct ulog_utmpx *ulog_getutxuser(const char *);
87 int ulog_setutxfile(int, const char *);
90 #define UTXF_LASTLOG 2
92 /* Login/logout utility functions. */
93 void ulog_login(const char *, const char *, const char *);
94 void ulog_login_pseudo(int, const char *);
95 void ulog_logout(const char *);
96 void ulog_logout_pseudo(int);
99 #ifdef _ULOG_POSIX_NAMES
100 #define utmpx ulog_utmpx
101 #define endutxent ulog_endutxent
102 #define getutxent ulog_getutxent
103 #define getutxline ulog_getutxline
104 #define pututxline ulog_pututxline
105 #define setutxent ulog_setutxent
106 #endif /* _ULOG_POSIX_NAMES */
108 #endif /* !_ULOG_H_ */