1 /* 2 * internal helper for utmp and utmpx handling 3 * 4 * Copyright (C) 2015 by Bernhard Reutner-Fischer 5 * 6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 */ 8 #ifndef __INTERNAL_UTMP_H 9 #define __INTERNAL_UTMP_H 10 11 #include <utmpx.h> 12 #include <utmp.h> 13 14 /* Note: _PATH_UTMPX == _PATH_UTMP */ 15 16 #if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \ 17 || !defined __UCLIBC_HAS_UTMP__ 18 /* implement the X and alias the non-X */ 19 # define __set_unlocked __setutxent_unlocked 20 # define set setutxent 21 # define __get_unlocked __getutxent_unlocked 22 # define get getutxent 23 # define end endutxent 24 # define __getid_unlocked __getutxid_unlocked 25 # define getid getutxid 26 # define getline getutxline 27 # define putline pututxline 28 # define name utmpxname 29 # define updw updwtmpx 30 # define UT utmpx 31 # ifndef __DEFAULT_PATH_UTMP 32 # define __DEFAULT_PATH_UTMP _PATH_UTMPX 33 # endif 34 # if defined __UCLIBC_HAS_UTMP__ 35 # define other(n,a) strong_alias_untyped(n,a) 36 # else 37 # define other(n,a) /* nothing */ 38 # endif 39 #elif defined __UCLIBC_HAS_UTMP__ 40 # define __set_unlocked __setutent_unlocked 41 # define set setutent 42 # define __get_unlocked __getutent_unlocked 43 # define get getutent 44 # define end endutent 45 # define __getid_unlocked __getutid_unlocked 46 # define getid getutid 47 # define getline getutline 48 # define putline pututline 49 # define name utmpname 50 # define updw updwtmp 51 # define UT utmp 52 # ifndef __DEFAULT_PATH_UTMP 53 # define __DEFAULT_PATH_UTMP _PATH_UTMP 54 # endif 55 # define other(n,a) /* nothing */ 56 #else 57 #error You are supposed to either have UTMP or UTMPX or both here 58 #endif 59 60 /* not used in libc_hidden_proto(setutxent) */ 61 /* not used in libc_hidden_proto(endutxent) */ 62 /* not used in libc_hidden_proto(getutxent) */ 63 /* not used in libc_hidden_proto(getutxid) */ 64 /* not used in libc_hidden_proto(getutxline) */ 65 /* not used in libc_hidden_proto(pututxline) */ 66 /* not used in libc_hidden_proto(utmpxname) */ 67 /* not used in libc_hidden_proto(updwtmpx) */ 68 69 /* not used in libc_hidden_proto(setutent) */ 70 /* not used in libc_hidden_proto(endutent) */ 71 /* not used in libc_hidden_proto(getutent) */ 72 /* not used in libc_hidden_proto(getutid) */ 73 /* not used in libc_hidden_proto(getutline) */ 74 /* not used in libc_hidden_proto(pututline) */ 75 /* not used in libc_hidden_proto(utmpname) */ 76 /* not used in libc_hidden_proto(updwtmp) */ 77 78 #ifdef IS_IN_libutil 79 # if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \ 80 || !defined __UCLIBC_HAS_UTMP__ 81 /* monkey-patch to use the POSIX interface */ 82 # define setutent setutxent 83 # define getutline getutxline 84 # define pututline pututxline 85 # define endutent endutxent 86 # define updwtmp updwtmpx 87 # endif 88 #endif /* IS_IN_libutil */ 89 90 #endif /* __INTERNAL_UTMP_H */ 91 92