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