2 ===================================================================
3 --- utmpx.h (revision 59377)
4 +++ utmpx.h (working copy)
7 + * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved.
9 + * @APPLE_LICENSE_HEADER_START@
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
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.
26 + * @APPLE_LICENSE_HEADER_END@
28 /* $NetBSD: utmpx.h,v 1.11 2003/08/26 16:48:32 wiz Exp $ */
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>
45 +typedef __darwin_pid_t pid_t;
48 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
51 +typedef __darwin_uid_t uid_t;
53 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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"
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 */
65 +#define _UTX_USERSIZE 256 /* matches MAXLOGNAME */
66 #define _UTX_LINESIZE 32
68 #define _UTX_HOSTSIZE 256
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
81 #define USER_PROCESS 7
82 #define DEAD_PROCESS 8
84 -#if defined(_NETBSD_SOURCE)
85 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
89 +#define SHUTDOWN_TIME 11
91 +#define UTMPX_AUTOFILL_MASK 0x8000
92 +#define UTMPX_DEAD_IF_CORRESPONDING_MASK 0x4000
94 +/* notify(3) change notification name */
95 +#define UTMPX_CHANGE_NOTIFICATION "com.apple.system.utmpx"
96 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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).
106 +#ifdef _UTMPX_COMPAT
107 #define ut_user ut_name
108 #define ut_xtime ut_tv.tv_sec
109 +#endif /* _UTMPX_COMPAT */
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 */
122 - uint16_t e_termination; /* process termination signal */
123 - uint16_t e_exit; /* process exit status */
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 */
133 -#if defined(_NETBSD_SOURCE)
134 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
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 */
141 -#endif /* !_XOPEN_SOURCE */
142 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
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);
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 *));
161 -struct lastlogx *getlastlogx __P((const char *, uid_t, struct lastlogx *))
162 - __RENAME(__getlastlogx13);
164 -int updlastlogx __P((const char *, uid_t, struct lastlogx *));
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);
171 + getlastlogx(uid_t, struct lastlogx *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
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 */
181 -int utmpxname __P((const char *));
185 -#endif /* _NETBSD_SOURCE */
186 +#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
188 + getutxent_wtmp(void) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
189 +#endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */
192 + getutxid(const struct utmpx *);
194 + getutxline(const struct utmpx *);
196 + pututxline(const struct utmpx *);
197 +void setutxent(void);
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 */
207 #endif /* !_UTMPX_H_ */