X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/34e8f8296870d0e8695f90e1a54240a589d41312..HEAD:/gen/utmpx-darwin.h diff --git a/gen/utmpx-darwin.h b/gen/utmpx-darwin.h index a150547..ae4733c 100644 --- a/gen/utmpx-darwin.h +++ b/gen/utmpx-darwin.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2005, 2009 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -22,6 +22,10 @@ * @APPLE_LICENSE_HEADER_END@ */ #include +#include +#include +#include +#include #ifdef UTMP_COMPAT #define UTMP_COMPAT_UTMP0 0x01 @@ -33,16 +37,32 @@ #define LASTLOG_FACILITY "com.apple.system.lastlog" #define UTMPX_FACILITY "com.apple.system.utmpx" -#define UTMPX_LOCK if (__is_threaded) pthread_mutex_lock(&utmpx_mutex) -#define UTMPX_UNLOCK if (__is_threaded) pthread_mutex_unlock(&utmpx_mutex) +#define UTMPX_LOCK(x) pthread_mutex_lock(&(x)->utmpx_mutex) +#define UTMPX_UNLOCK(x) pthread_mutex_unlock(&(x)->utmpx_mutex) +#define UTMPX_MAGIC 8 +#define __UTX_MAGIC__ { 'u', 't', 'x', 0, 'v', 1, 0, 0 } -extern int utfile_system; /* are we using _PATH_UTMPX? */ -extern int __is_threaded; -extern pthread_mutex_t utmpx_mutex; +#define TEST_UTMPX_T(x,y) { \ + if (!(y)) \ + LIBC_ABORT("%s: NULL utmpx_t", (x)); \ + if (memcmp((y)->magic, __utx_magic__, UTMPX_MAGIC) != 0) \ + LIBC_ABORT("%s: magic mismatch", (x)); \ + } + +struct _utmpx { + char magic[UTMPX_MAGIC]; + struct utmpx ut; + pthread_mutex_t utmpx_mutex; + char *utfile; + FILE *fp; + unsigned int utfile_system :1; /* are we using _PATH_UTMPX? */ + unsigned int readonly :1; +}; +extern const char __utx_magic__[]; /* size of UTMPX_MAGIC */ #ifdef __LP64__ -#define __need_struct_timeval32 -#include <_structs.h> +#include +#include /* * these structures assume natural alignment so they are the same size @@ -75,9 +95,13 @@ struct utmpx32 { }; #endif /* __LP64__ */ -void _endutxent(void); -void _setutxent(void); -struct utmpx *_pututxline(const struct utmpx *); +struct _utmpx *__default_utx(void); + +void __endutxent(struct _utmpx *); +struct utmpx *__getutxent(struct _utmpx *); +void __setutxent(struct _utmpx *); +struct utmpx *__pututxline(struct _utmpx *, const struct utmpx *); +int __utmpxname(struct _utmpx *, const char *); #ifdef __LP64__ void _utmpx32_64(const struct utmpx32 *, struct utmpx *); void _utmpx64_32(const struct utmpx *, struct utmpx32 *);