Print this page
remove support for non-ANSI compilation
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/utmp.h
+++ new/usr/src/head/utmp.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /* Copyright (c) 1988 AT&T */
23 23 /* All Rights Reserved */
24 24
25 25
26 26 /*
27 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 + *
27 29 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 30 * Use is subject to license terms.
29 31 */
30 32
31 33
32 34 #ifndef _UTMP_H
33 35 #define _UTMP_H
34 36
35 -#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.5.1.7 */
36 -
37 37 /*
38 38 * Note: The getutent(3c) family of interfaces are obsolete.
39 39 * The getutxent(3c) family provide a superset of this functionality
40 40 * and should be used in place of getutent(3c).
41 41 */
42 42
43 43 #include <sys/types.h>
44 44
45 45 #ifdef __cplusplus
46 46 extern "C" {
47 47 #endif
48 48
49 49 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
50 50 #define UTMP_FILE "/var/adm/utmp"
51 51 #define WTMP_FILE "/var/adm/wtmp"
52 52 #endif
53 53
54 54 #define ut_name ut_user
55 55
56 56 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
57 57 struct exit_status {
58 58 short e_termination; /* Process termination status */
59 59 short e_exit; /* Process exit status */
60 60 };
61 61 #else
62 62 struct ut_exit_status {
63 63 short ut_e_termination; /* Process termination status */
64 64 short ut_e_exit; /* Process exit status */
65 65 };
66 66 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
67 67
68 68 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
69 69
70 70 /*
71 71 * This data structure describes the utmp entries returned by
72 72 * the getutent(3c) family of APIs. It does not (necessarily)
73 73 * correspond to the contents of the utmp or wtmp files.
74 74 *
75 75 * Applications should only interact with this subsystem via
76 76 * the getutxent(3c) family of APIs, as the getutent(3c) family
77 77 * are obsolete.
78 78 */
79 79 struct utmp {
80 80 char ut_user[8]; /* User login name */
81 81 char ut_id[4]; /* /etc/inittab id(usually line #) */
82 82 char ut_line[12]; /* device name (console, lnxx) */
83 83 short ut_pid; /* short for compat. - process id */
84 84 short ut_type; /* type of entry */
85 85 struct exit_status ut_exit; /* The exit status of a process */
86 86 /* marked as DEAD_PROCESS. */
87 87 time_t ut_time; /* time entry was made */
88 88 };
89 89
90 90 #include <sys/types32.h>
91 91 #include <inttypes.h>
92 92
93 93 /*
94 94 * This data structure describes the utmp *file* contents using
95 95 * fixed-width data types. It should only be used by the implementation.
96 96 *
97 97 * Applications should use the getutxent(3c) family of routines to interact
98 98 * with this database.
99 99 */
100 100
101 101 struct futmp {
102 102 char ut_user[8]; /* User login name */
103 103 char ut_id[4]; /* /etc/inittab id */
104 104 char ut_line[12]; /* device name (console, lnxx) */
105 105 int16_t ut_pid; /* process id */
106 106 int16_t ut_type; /* type of entry */
107 107 struct {
108 108 int16_t e_termination; /* Process termination status */
109 109 int16_t e_exit; /* Process exit status */
110 110 } ut_exit; /* The exit status of a process */
111 111 time32_t ut_time; /* time entry was made */
112 112 };
113 113
114 114 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
115 115
116 116 /* Definitions for ut_type */
117 117
118 118 #define EMPTY 0
119 119 #define RUN_LVL 1
120 120 #define BOOT_TIME 2
121 121 #define OLD_TIME 3
122 122 #define NEW_TIME 4
123 123 #define INIT_PROCESS 5 /* Process spawned by "init" */
124 124 #define LOGIN_PROCESS 6 /* A "getty" process waiting for login */
125 125 #define USER_PROCESS 7 /* A user process */
126 126 #define DEAD_PROCESS 8
127 127
128 128 #if !defined(_XPG4_2) || defined(__EXTENSIONS__)
129 129
130 130 #define ACCOUNTING 9
131 131 #define DOWN_TIME 10
132 132
133 133 #define UTMAXTYPE DOWN_TIME /* Largest legal value of ut_type */
134 134
135 135 /* Special strings or formats used in the "ut_line" field when */
136 136 /* accounting for something other than a process. */
137 137 /* No string for the ut_line field can be more than 11 chars + */
138 138 /* a NULL in length. */
139 139
140 140 #define RUNLVL_MSG "run-level %c"
141 141 #define BOOT_MSG "system boot"
142 142 #define OTIME_MSG "old time"
143 143 #define NTIME_MSG "new time"
↓ open down ↓ |
97 lines elided |
↑ open up ↑ |
144 144 #define PSRADM_MSG "%03d %s" /* processor on or off */
145 145 #define DOWN_MSG "system down"
146 146
147 147 /* Define and macro for determing if a normal user wrote the entry */
148 148 /* and marking the utmpx entry as a normal user */
149 149 #define NONROOT_USR 2
150 150 #define nonuser(ut) ((ut).ut_exit.e_exit == NONROOT_USR ? 1 : 0)
151 151 #define setuser(ut) ((ut).ut_exit.e_exit = NONROOT_USR)
152 152
153 153
154 -#if defined(__STDC__)
155 154 extern void endutent(void);
156 155 extern struct utmp *getutent(void);
157 156 extern struct utmp *getutid(const struct utmp *);
158 157 extern struct utmp *getutline(const struct utmp *);
159 158 extern struct utmp *pututline(const struct utmp *);
160 159 extern void setutent(void);
161 160 extern int utmpname(const char *);
162 -#else
163 -extern void endutent();
164 -extern struct utmp *getutent();
165 -extern struct utmp *getutid();
166 -extern struct utmp *getutline();
167 -extern struct utmp *pututline();
168 -extern void setutent();
169 -extern int utmpname();
170 -#endif
171 161
172 162 #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
173 163
174 164 #ifdef __cplusplus
175 165 }
176 166 #endif
177 167
178 168 #endif /* _UTMP_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX