Back to index

glibc  2.9
utmp.h
Go to the documentation of this file.
00001 /* Copyright (C) 1993, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef       _UTMP_H
00020 #define       _UTMP_H       1
00021 
00022 #include <features.h>
00023 
00024 #include <sys/types.h>
00025 
00026 
00027 __BEGIN_DECLS
00028 
00029 /* Get system dependent values and data structures.  */
00030 #include <bits/utmp.h>
00031 
00032 /* Compatibility names for the strings of the canonical file names.  */
00033 #define UTMP_FILE    _PATH_UTMP
00034 #define UTMP_FILENAME       _PATH_UTMP
00035 #define WTMP_FILE    _PATH_WTMP
00036 #define WTMP_FILENAME       _PATH_WTMP
00037 
00038 
00039 
00040 /* Make FD be the controlling terminal, stdin, stdout, and stderr;
00041    then close FD.  Returns 0 on success, nonzero on error.  */
00042 extern int login_tty (int __fd) __THROW;
00043 
00044 
00045 /* Write the given entry into utmp and wtmp.  */
00046 extern void login (__const struct utmp *__entry) __THROW;
00047 
00048 /* Write the utmp entry to say the user on UT_LINE has logged out.  */
00049 extern int logout (__const char *__ut_line) __THROW;
00050 
00051 /* Append to wtmp an entry for the current time and the given info.  */
00052 extern void logwtmp (__const char *__ut_line, __const char *__ut_name,
00053                    __const char *__ut_host) __THROW;
00054 
00055 /* Append entry UTMP to the wtmp-like file WTMP_FILE.  */
00056 extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp)
00057      __THROW;
00058 
00059 /* Change name of the utmp file to be examined.  */
00060 extern int utmpname (__const char *__file) __THROW;
00061 
00062 /* Read next entry from a utmp-like file.  */
00063 extern struct utmp *getutent (void) __THROW;
00064 
00065 /* Reset the input stream to the beginning of the file.  */
00066 extern void setutent (void) __THROW;
00067 
00068 /* Close the current open file.  */
00069 extern void endutent (void) __THROW;
00070 
00071 /* Search forward from the current point in the utmp file until the
00072    next entry with a ut_type matching ID->ut_type.  */
00073 extern struct utmp *getutid (__const struct utmp *__id) __THROW;
00074 
00075 /* Search forward from the current point in the utmp file until the
00076    next entry with a ut_line matching LINE->ut_line.  */
00077 extern struct utmp *getutline (__const struct utmp *__line) __THROW;
00078 
00079 /* Write out entry pointed to by UTMP_PTR into the utmp file.  */
00080 extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW;
00081 
00082 
00083 #ifdef __USE_MISC
00084 /* Reentrant versions of the file for handling utmp files.  */
00085 extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
00086 
00087 extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer,
00088                     struct utmp **__result) __THROW;
00089 
00090 extern int getutline_r (__const struct utmp *__line,
00091                      struct utmp *__buffer, struct utmp **__result) __THROW;
00092 
00093 #endif /* Use misc.  */
00094 
00095 __END_DECLS
00096 
00097 #endif /* utmp.h  */