2 * Copyright (c) 2005, 2009 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 2004 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
28 #include <sys/param.h>
31 #define UTMP_COMPAT_UTMP0 0x01
32 #define UTMP_COMPAT_UTMP1 0x02
33 #define UTMP_COMPAT_WTMP 0x04
34 #define UTMP_COMPAT_LASTLOG 0x08
35 #endif /* UTMP_COMPAT */
37 #define LASTLOG_FACILITY "com.apple.system.lastlog"
38 #define UTMPX_FACILITY "com.apple.system.utmpx"
40 #define UTMPX_LOCK(x) pthread_mutex_lock(&(x)->utmpx_mutex)
41 #define UTMPX_UNLOCK(x) pthread_mutex_unlock(&(x)->utmpx_mutex)
43 #define __UTX_MAGIC__ { 'u', 't', 'x', 0, 'v', 1, 0, 0 }
45 #define TEST_UTMPX_T(x,y) { \
47 LIBC_ABORT("%s: NULL utmpx_t", (x)); \
48 if (memcmp((y)->magic, __utx_magic__, UTMPX_MAGIC) != 0) \
49 LIBC_ABORT("%s: magic mismatch", (x)); \
53 char magic
[UTMPX_MAGIC
];
55 pthread_mutex_t utmpx_mutex
;
58 unsigned int utfile_system
:1; /* are we using _PATH_UTMPX? */
59 unsigned int readonly
:1;
61 extern const char __utx_magic__
[]; /* size of UTMPX_MAGIC */
64 #include <sys/_types.h>
65 #include <sys/_types/_timeval32.h>
68 * these structures assume natural alignment so they are the same size
69 * and layout as their 32-bit counterpart
74 char ll_line
[UT_LINESIZE
];
75 char ll_host
[UT_HOSTSIZE
];
79 char ut_line
[UT_LINESIZE
];
80 char ut_name
[UT_NAMESIZE
];
81 char ut_host
[UT_HOSTSIZE
];
84 #endif /* UTMP_COMPAT */
87 char ut_user
[_UTX_USERSIZE
]; /* login name */
88 char ut_id
[_UTX_IDSIZE
]; /* id */
89 char ut_line
[_UTX_LINESIZE
]; /* tty name */
90 pid_t ut_pid
; /* process id creating the entry */
91 short ut_type
; /* type of this entry */
92 struct timeval32 ut_tv
; /* time entry was created */
93 char ut_host
[_UTX_HOSTSIZE
]; /* host name */
94 __uint32_t ut_pad
[16]; /* reserved for future use */
98 struct _utmpx
*__default_utx(void);
100 void __endutxent(struct _utmpx
*);
101 struct utmpx
*__getutxent(struct _utmpx
*);
102 void __setutxent(struct _utmpx
*);
103 struct utmpx
*__pututxline(struct _utmpx
*, const struct utmpx
*);
104 int __utmpxname(struct _utmpx
*, const char *);
106 void _utmpx32_64(const struct utmpx32
*, struct utmpx
*);
107 void _utmpx64_32(const struct utmpx
*, struct utmpx32
*);
108 #endif /* __LP64__ */
109 void _utmpx_asl(const struct utmpx
*);
110 const struct utmpx
*_utmpx_working_copy(const struct utmpx
*, struct utmpx
*, int);
114 void _getutmp32(const struct utmpx
*, struct utmp32
*);
115 int _utmp_compat(const struct utmpx
*, struct utmp32
*);
116 void _write_lastlog(const struct utmp32
*, const struct utmpx
*);
117 void _write_utmp(const struct utmp32
*, int);
119 int _utmp_compat(const struct utmpx
*, struct utmp
*);
120 void _write_lastlog(const struct utmp
*, const struct utmpx
*);
121 void _write_utmp(const struct utmp
*, int);
122 #endif /* __LP64__ */
123 void _write_utmp_compat(const struct utmpx
*);
125 void _write_wtmp(const struct utmp32
*);
127 void _write_wtmp(const struct utmp
*);
128 #endif /* __LP64__ */
129 #endif /* UTMP_COMPAT */