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