]> git.saurik.com Git - apple/libc.git/blob - gen/utmpx-darwin.h
a15054721b551095b989abb0188874209c389dac
[apple/libc.git] / gen / utmpx-darwin.h
1 /*
2 * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
12 * this file.
13 *
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
20 * under the License."
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 #include <pthread.h>
25
26 #ifdef UTMP_COMPAT
27 #define UTMP_COMPAT_UTMP0 0x01
28 #define UTMP_COMPAT_UTMP1 0x02
29 #define UTMP_COMPAT_WTMP 0x04
30 #define UTMP_COMPAT_LASTLOG 0x08
31 #endif /* UTMP_COMPAT */
32
33 #define LASTLOG_FACILITY "com.apple.system.lastlog"
34 #define UTMPX_FACILITY "com.apple.system.utmpx"
35
36 #define UTMPX_LOCK if (__is_threaded) pthread_mutex_lock(&utmpx_mutex)
37 #define UTMPX_UNLOCK if (__is_threaded) pthread_mutex_unlock(&utmpx_mutex)
38
39 extern int utfile_system; /* are we using _PATH_UTMPX? */
40 extern int __is_threaded;
41 extern pthread_mutex_t utmpx_mutex;
42
43 #ifdef __LP64__
44 #define __need_struct_timeval32
45 #include <_structs.h>
46
47 /*
48 * these structures assume natural alignment so they are the same size
49 * and layout as their 32-bit counterpart
50 */
51 #ifdef UTMP_COMPAT
52 struct lastlog32 {
53 __int32_t ll_time;
54 char ll_line[UT_LINESIZE];
55 char ll_host[UT_HOSTSIZE];
56 };
57
58 struct utmp32 {
59 char ut_line[UT_LINESIZE];
60 char ut_name[UT_NAMESIZE];
61 char ut_host[UT_HOSTSIZE];
62 __int32_t ut_time;
63 };
64 #endif /* UTMP_COMPAT */
65
66 struct utmpx32 {
67 char ut_user[_UTX_USERSIZE]; /* login name */
68 char ut_id[_UTX_IDSIZE]; /* id */
69 char ut_line[_UTX_LINESIZE]; /* tty name */
70 pid_t ut_pid; /* process id creating the entry */
71 short ut_type; /* type of this entry */
72 struct timeval32 ut_tv; /* time entry was created */
73 char ut_host[_UTX_HOSTSIZE]; /* host name */
74 __uint32_t ut_pad[16]; /* reserved for future use */
75 };
76 #endif /* __LP64__ */
77
78 void _endutxent(void);
79 void _setutxent(void);
80 struct utmpx *_pututxline(const struct utmpx *);
81 #ifdef __LP64__
82 void _utmpx32_64(const struct utmpx32 *, struct utmpx *);
83 void _utmpx64_32(const struct utmpx *, struct utmpx32 *);
84 #endif /* __LP64__ */
85 void _utmpx_asl(const struct utmpx *);
86 const struct utmpx *_utmpx_working_copy(const struct utmpx *, struct utmpx *, int);
87
88 #ifdef UTMP_COMPAT
89 #ifdef __LP64__
90 void _getutmp32(const struct utmpx *, struct utmp32 *);
91 int _utmp_compat(const struct utmpx *, struct utmp32 *);
92 void _write_lastlog(const struct utmp32 *, const struct utmpx *);
93 void _write_utmp(const struct utmp32 *, int);
94 #else /* __LP64__ */
95 int _utmp_compat(const struct utmpx *, struct utmp *);
96 void _write_lastlog(const struct utmp *, const struct utmpx *);
97 void _write_utmp(const struct utmp *, int);
98 #endif /* __LP64__ */
99 void _write_utmp_compat(const struct utmpx *);
100 #ifdef __LP64__
101 void _write_wtmp(const struct utmp32 *);
102 #else /* __LP64__ */
103 void _write_wtmp(const struct utmp *);
104 #endif /* __LP64__ */
105 #endif /* UTMP_COMPAT */