1 /* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef _UTMP_H 19 #define _UTMP_H 1 20 21 #include <features.h> 22 23 #include <sys/types.h> 24 25 26 __BEGIN_DECLS 27 28 /* Get system dependent values and data structures. */ 29 #include <bits/utmp.h> 30 31 /* Compatibility names for the strings of the canonical file names. */ 32 #define UTMP_FILE _PATH_UTMP 33 #define UTMP_FILENAME _PATH_UTMP 34 #define WTMP_FILE _PATH_WTMP 35 #define WTMP_FILENAME _PATH_WTMP 36 37 38 39 #ifdef __UCLIBC_HAS_LIBUTIL__ 40 /* Make FD be the controlling terminal, stdin, stdout, and stderr; 41 then close FD. Returns 0 on success, nonzero on error. */ 42 extern int login_tty (int __fd) __THROW; 43 44 45 /* Write the given entry into utmp and wtmp. */ 46 extern void login (const struct utmp *__entry) __THROW; 47 48 /* Write the utmp entry to say the user on UT_LINE has logged out. */ 49 extern int logout (const char *__ut_line) __THROW; 50 51 /* Append to wtmp an entry for the current time and the given info. */ 52 extern void logwtmp (const char *__ut_line, const char *__ut_name, 53 const char *__ut_host) __THROW; 54 #endif 55 56 /* Append entry UTMP to the wtmp-like file WTMP_FILE. */ 57 extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp) 58 __THROW; 59 60 /* Change name of the utmp file to be examined. */ 61 extern int utmpname (const char *__file) __THROW; 62 63 /* Read next entry from a utmp-like file. */ 64 extern struct utmp *getutent (void) __THROW; 65 66 /* Reset the input stream to the beginning of the file. */ 67 extern void setutent (void) __THROW; 68 69 /* Close the current open file. */ 70 extern void endutent (void) __THROW; 71 72 /* Search forward from the current point in the utmp file until the 73 next entry with a ut_type matching ID->ut_type. */ 74 extern struct utmp *getutid (const struct utmp *__id) __THROW; 75 76 /* Search forward from the current point in the utmp file until the 77 next entry with a ut_line matching LINE->ut_line. */ 78 extern struct utmp *getutline (const struct utmp *__line) __THROW; 79 80 /* Write out entry pointed to by UTMP_PTR into the utmp file. */ 81 extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW; 82 83 84 #if 0 /* def __USE_MISC */ 85 /* Reentrant versions of the file for handling utmp files. */ 86 extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW; 87 88 extern int getutid_r (const struct utmp *__id, struct utmp *__buffer, 89 struct utmp **__result) __THROW; 90 91 extern int getutline_r (const struct utmp *__line, 92 struct utmp *__buffer, struct utmp **__result) __THROW; 93 94 #endif /* Use misc. */ 95 96 __END_DECLS 97 98 #endif /* utmp.h */ 99