drm/i915: Remove a duplicated assignment
[dragonfly.git] / include / utmpx.h
blobb8f8e71fe7d65d8d3f9c9b847212900fe564456e
1 /*-
2 * Copyright (c) 2002 The NetBSD Foundation, Inc.
3 * All rights reserved.
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Christos Zoulas.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _UTMPX_H_
31 #define _UTMPX_H_
33 #include <sys/cdefs.h>
34 #include <sys/socket.h>
35 #include <sys/time.h>
37 #define _PATH_UTMPX "/var/run/utmpx"
38 #define _PATH_WTMPX "/var/log/wtmpx"
39 #define _PATH_LASTLOGX "/var/log/lastlogx"
40 #define _PATH_UTMP_UPDATE "/usr/libexec/utmp_update"
42 #define _UTX_USERSIZE 32
43 #define _UTX_LINESIZE 32
44 #define _UTX_IDSIZE 4
45 #define _UTX_HOSTSIZE 256
47 #define UTX_USERSIZE _UTX_USERSIZE
48 #define UTX_LINESIZE _UTX_LINESIZE
49 #define UTX_IDSIZE _UTX_IDSIZE
50 #define UTX_HOSTSIZE _UTX_HOSTSIZE
53 #define EMPTY 0
54 #if __BSD_VISIBLE
55 #define RUN_LVL 1
56 #endif
57 #define BOOT_TIME 2
58 #define OLD_TIME 3
59 #define NEW_TIME 4
60 #define INIT_PROCESS 5
61 #define LOGIN_PROCESS 6
62 #define USER_PROCESS 7
63 #define DEAD_PROCESS 8
65 #define ACCOUNTING 9
66 #define SIGNATURE 10
67 #define DOWN_TIME 11
70 * Strings placed in the ut_line field to indicate special type entries
72 #define RUNLVL_MSG "run-level %c"
73 #define BOOT_MSG "system boot"
74 #define OTIME_MSG "old time"
75 #define NTIME_MSG "new time"
76 #define DOWN_MSG "system down"
78 #define ut_user ut_name
79 #define ut_xtime ut_tv.tv_sec
81 typedef enum {
82 UTX_DB_UTMPX,
83 UTX_DB_WTMPX,
84 UTX_DB_LASTLOGX
85 } utx_db_t;
87 struct exit_status
89 uint16_t e_termination; /* termination status */
90 uint16_t e_exit; /* exit status */
93 struct utmpx {
94 char ut_name[_UTX_USERSIZE]; /* login name */
95 char ut_id[_UTX_IDSIZE]; /* inittab id */
96 char ut_line[_UTX_LINESIZE]; /* tty name */
97 char ut_host[_UTX_HOSTSIZE]; /* host name */
98 uint8_t ut_unused[16]; /* reserved for future use */
99 uint16_t ut_session; /* session id used for windowing */
100 uint16_t ut_type; /* type of this entry */
101 pid_t ut_pid; /* process id creating the entry */
102 struct exit_status ut_exit; /* process termination/exit status */
103 struct sockaddr_storage ut_ss; /* address where entry was made from */
104 struct timeval ut_tv; /* time entry was created */
105 uint8_t ut_unused2[16]; /* reserved for future use */
108 struct lastlogx {
109 struct timeval ll_tv; /* time entry was created */
110 char ll_line[_UTX_LINESIZE]; /* tty name */
111 char ll_host[_UTX_HOSTSIZE]; /* host name */
112 struct sockaddr_storage ll_ss; /* address where entry was made from */
115 __BEGIN_DECLS
116 void endutxent(void);
117 struct utmpx *getutxent(void);
118 struct utmpx *getutxid(const struct utmpx *);
119 struct utmpx *getutxline(const struct utmpx *);
120 struct utmpx *pututxline(const struct utmpx *);
121 void setutxent(void);
123 #ifdef __BSD_VISIBLE
124 int _updwtmpx(const char *, const struct utmpx *);
125 void updwtmpx(const char *, const struct utmpx *);
126 struct lastlogx *getlastlogx(const char *, uid_t, struct lastlogx *);
127 int updlastlogx(const char *, uid_t, struct lastlogx *);
128 struct utmp;
129 void getutmp(const struct utmpx *, struct utmp *);
130 void getutmpx(const struct utmp *, struct utmpx *);
131 int utmpxname(const char *);
132 int setutxdb(utx_db_t, char *);
133 #endif
134 __END_DECLS
136 #endif /* _UTMPX_H_ */