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