1 --- utmpx.h.orig 2006-10-01 22:22:21.000000000 -0700
2 +++ utmpx.h 2006-10-02 02:08:04.000000000 -0700
5 + * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
7 + * @APPLE_LICENSE_HEADER_START@
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
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.
24 + * @APPLE_LICENSE_HEADER_END@
26 /* $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $ */
33 -#include <sys/cdefs.h>
34 -#include <sys/featuretest.h>
35 -#include <sys/socket.h>
41 +typedef __darwin_pid_t pid_t;
44 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
47 +typedef __darwin_uid_t uid_t;
49 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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"
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 */
61 +#define _UTX_USERSIZE 256 /* matches MAXLOGNAME */
62 #define _UTX_LINESIZE 32
64 #define _UTX_HOSTSIZE 256
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
77 #define USER_PROCESS 7
78 #define DEAD_PROCESS 8
80 -#if defined(_NETBSD_SOURCE)
81 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
85 +#define SHUTDOWN_TIME 11
87 +#define UTMPX_AUTOFILL_MASK 0x8000
88 +#define UTMPX_DEAD_IF_CORRESPONDING_MASK 0x4000
90 +/* notify(3) change notification name */
91 +#define UTMPX_CHANGE_NOTIFICATION "com.apple.system.utmpx"
92 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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).
102 +#ifdef _UTMPX_COMPAT
103 #define ut_user ut_name
104 #define ut_xtime ut_tv.tv_sec
105 +#endif /* _UTMPX_COMPAT */
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 */
118 - uint16_t e_termination; /* process termination signal */
119 - uint16_t e_exit; /* process exit status */
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 */
129 -#if defined(_NETBSD_SOURCE)
130 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
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 */
137 -#endif /* !_XOPEN_SOURCE */
138 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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 *));
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 *));
156 -struct lastlogx *getlastlogx __P((const char *, uid_t, struct lastlogx *))
157 - __RENAME(__getlastlogx13);
159 -int updlastlogx __P((const char *, uid_t, struct lastlogx *));
161 -void getutmp __P((const struct utmpx *, struct utmp *));
162 -void getutmpx __P((const struct utmp *, struct utmpx *));
164 -int utmpxname __P((const char *));
165 +void endutxent(void);
167 -#endif /* _NETBSD_SOURCE */
168 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
169 +void endutxent_wtmp(void);
171 + getlastlogx(uid_t, 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 */
182 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
184 + getutxent_wtmp(void);
185 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
188 + getutxid(const struct utmpx *);
190 + getutxline(const struct utmpx *);
192 + pututxline(const struct utmpx *);
193 +void setutxent(void);
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 */