]> git.saurik.com Git - apple/libc.git/blob - include/NetBSD/utmpx.h.patch
Libc-498.tar.gz
[apple/libc.git] / include / NetBSD / utmpx.h.patch
1 --- utmpx.h.orig 2006-10-01 22:22:21.000000000 -0700
2 +++ utmpx.h 2006-10-02 02:08:04.000000000 -0700
3 @@ -1,3 +1,25 @@
4 +/*
5 + * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
6 + *
7 + * @APPLE_LICENSE_HEADER_START@
8 + *
9 + * This file contains Original Code and/or Modifications of Original Code
10 + * as defined in and that are subject to the Apple Public Source License
11 + * Version 2.0 (the 'License'). You may not use this file except in
12 + * compliance with the License. Please obtain a copy of the License at
13 + * http://www.opensource.apple.com/apsl/ and read it before using this
14 + * file.
15 + *
16 + * The Original Code and all software distributed under the License are
17 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
18 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
19 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
20 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
21 + * Please see the License for the specific language governing rights and
22 + * limitations under the License.
23 + *
24 + * @APPLE_LICENSE_HEADER_END@
25 + */
26 /* $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $ */
27
28 /*-
29 @@ -38,28 +60,32 @@
30 #ifndef _UTMPX_H_
31 #define _UTMPX_H_
32
33 -#include <sys/cdefs.h>
34 -#include <sys/featuretest.h>
35 -#include <sys/socket.h>
36 +#include <_types.h>
37 #include <sys/time.h>
38
39 +#ifndef _PID_T
40 +#define _PID_T
41 +typedef __darwin_pid_t pid_t;
42 +#endif
43 +
44 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
45 +#ifndef _UID_T
46 +#define _UID_T
47 +typedef __darwin_uid_t uid_t;
48 +#endif
49 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
50 +
51 #define _PATH_UTMPX "/var/run/utmpx"
52 -#define _PATH_WTMPX "/var/log/wtmpx"
53 -#define _PATH_LASTLOGX "/var/log/lastlogx"
54 -#define _PATH_UTMP_UPDATE "/usr/libexec/utmp_update"
55
56 -#define _UTX_USERSIZE 32
57 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
58 +#define UTMPX_FILE _PATH_UTMPX
59 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
60 +
61 +#define _UTX_USERSIZE 256 /* matches MAXLOGNAME */
62 #define _UTX_LINESIZE 32
63 #define _UTX_IDSIZE 4
64 #define _UTX_HOSTSIZE 256
65
66 -#if defined(_NETBSD_SOURCE)
67 -#define UTX_USERSIZE _UTX_USERSIZE
68 -#define UTX_LINESIZE _UTX_LINESIZE
69 -#define UTX_IDSIZE _UTX_IDSIZE
70 -#define UTX_HOSTSIZE _UTX_HOSTSIZE
71 -#endif
72 -
73 #define EMPTY 0
74 #define RUN_LVL 1
75 #define BOOT_TIME 2
76 @@ -70,74 +96,85 @@
77 #define USER_PROCESS 7
78 #define DEAD_PROCESS 8
79
80 -#if defined(_NETBSD_SOURCE)
81 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
82 #define ACCOUNTING 9
83 #define SIGNATURE 10
84 -#endif
85 +#define SHUTDOWN_TIME 11
86 +
87 +#define UTMPX_AUTOFILL_MASK 0x8000
88 +#define UTMPX_DEAD_IF_CORRESPONDING_MASK 0x4000
89 +
90 +/* notify(3) change notification name */
91 +#define UTMPX_CHANGE_NOTIFICATION "com.apple.system.utmpx"
92 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
93
94 /*
95 * The following structure describes the fields of the utmpx entries
96 - * stored in _PATH_UTMPX or _PATH_WTMPX. This is not the format the
97 + * stored in _PATH_UTMPX. This is not the format the
98 * entries are stored in the files, and application should only access
99 * entries using routines described in getutxent(3).
100 */
101
102 +#ifdef _UTMPX_COMPAT
103 #define ut_user ut_name
104 #define ut_xtime ut_tv.tv_sec
105 +#endif /* _UTMPX_COMPAT */
106
107 struct utmpx {
108 - char ut_name[_UTX_USERSIZE]; /* login name */
109 - char ut_id[_UTX_IDSIZE]; /* inittab id */
110 + char ut_user[_UTX_USERSIZE]; /* login name */
111 + char ut_id[_UTX_IDSIZE]; /* id */
112 char ut_line[_UTX_LINESIZE]; /* tty name */
113 - char ut_host[_UTX_HOSTSIZE]; /* host name */
114 - uint16_t ut_session; /* session id used for windowing */
115 - uint16_t ut_type; /* type of this entry */
116 pid_t ut_pid; /* process id creating the entry */
117 - struct {
118 - uint16_t e_termination; /* process termination signal */
119 - uint16_t e_exit; /* process exit status */
120 - } ut_exit;
121 - struct sockaddr_storage ut_ss; /* address where entry was made from */
122 + short ut_type; /* type of this entry */
123 struct timeval ut_tv; /* time entry was created */
124 - uint32_t ut_pad[10]; /* reserved for future use */
125 + char ut_host[_UTX_HOSTSIZE]; /* host name */
126 + __uint32_t ut_pad[16]; /* reserved for future use */
127 };
128
129 -#if defined(_NETBSD_SOURCE)
130 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
131 struct lastlogx {
132 struct timeval ll_tv; /* time entry was created */
133 char ll_line[_UTX_LINESIZE]; /* tty name */
134 char ll_host[_UTX_HOSTSIZE]; /* host name */
135 - struct sockaddr_storage ll_ss; /* address where entry was made from */
136 };
137 -#endif /* !_XOPEN_SOURCE */
138 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
139
140 __BEGIN_DECLS
141
142 -void setutxent __P((void));
143 -void endutxent __P((void));
144 -struct utmpx *getutxent __P((void));
145 -struct utmpx *getutxid __P((const struct utmpx *));
146 -struct utmpx *getutxline __P((const struct utmpx *));
147 -struct utmpx *pututxline __P((const struct utmpx *));
148 -
149 -#if defined(_NETBSD_SOURCE)
150 -int updwtmpx __P((const char *, const struct utmpx *));
151 -int lastlogxname __P((const char *));
152 -#ifdef __LIBC12_SOURCE__
153 -struct lastlogx *getlastlogx __P((uid_t, struct lastlogx *));
154 -struct lastlogx *__getlastlogx13 __P((const char *, uid_t, struct lastlogx *));
155 -#else
156 -struct lastlogx *getlastlogx __P((const char *, uid_t, struct lastlogx *))
157 - __RENAME(__getlastlogx13);
158 -#endif
159 -int updlastlogx __P((const char *, uid_t, struct lastlogx *));
160 -struct utmp;
161 -void getutmp __P((const struct utmpx *, struct utmp *));
162 -void getutmpx __P((const struct utmp *, struct utmpx *));
163 -
164 -int utmpxname __P((const char *));
165 +void endutxent(void);
166
167 -#endif /* _NETBSD_SOURCE */
168 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
169 +void endutxent_wtmp(void);
170 +struct lastlogx *
171 + getlastlogx(uid_t, struct lastlogx *);
172 +struct lastlogx *
173 + getlastlogxbyname(const char*, struct lastlogx *);
174 +struct utmp; /* forward reference */
175 +void getutmp(const struct utmpx *, struct utmp *);
176 +void getutmpx(const struct utmp *, struct utmpx *);
177 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
178 +
179 +struct utmpx *
180 + getutxent(void);
181 +
182 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
183 +struct utmpx *
184 + getutxent_wtmp(void);
185 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
186 +
187 +struct utmpx *
188 + getutxid(const struct utmpx *);
189 +struct utmpx *
190 + getutxline(const struct utmpx *);
191 +struct utmpx *
192 + pututxline(const struct utmpx *);
193 +void setutxent(void);
194 +
195 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
196 +void setutxent_wtmp(int);
197 +int utmpxname(const char *);
198 +int wtmpxname(const char *);
199 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
200
201 __END_DECLS
202