Thu Jun 6 16:12:39 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[glibc.git] / login / utmp.h
blobb53e13a9e079535ab8bb697922f4b1f3032f49d4
1 /* Copyright (C) 1993, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 #ifndef _UTMP_H_
22 #define _UTMP_H_ 1
23 #include <features.h>
25 #include <sys/types.h>
27 /* Get system dependent values and data structures. */
28 #include <utmpbits.h>
31 /* Write the given entry into utmp and wtmp. */
32 extern void login __P ((__const struct utmp *));
34 /* Write the utmp entry to say the user on UT_LINE has logged out. */
35 extern int logout __P ((__const char *ut_line));
37 /* Append to wtmp an entry for the current time and the given info. */
38 extern void logwtmp __P ((__const char *ut_line, __const char *ut_name,
39 __const char *ut_host));
41 /* Change name of the examine utmp file. */
42 extern int utmpname __P ((__const char *__file));
44 /* Read next entry from a utmp-like file. */
45 extern struct utmp *getutent __P ((void));
47 /* Rest the input stream to the beginning of the file. */
48 extern void setutent __P ((void));
50 /* Close the current open file. */
51 extern void endutent __P ((void));
53 /* Search forward from the current point in the utmp file until the
54 next entry with a ut_type matching ID->ut_type. */
55 extern struct utmp *getutid __P ((__const struct utmp *__id));
57 /* Search forward from the current point in the utmp file until the
58 next entry with a ut_line matching LINE->ut_line. */
59 extern struct utmp *getutline __P ((__const struct utmp *__line));
61 /* Write out entry pointed to by UTMP_PTR into the utmp file. */
62 extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
65 #ifdef __USE_REENTRANT
66 /* Define the data structure needed for the reentrent version. */
67 struct utmp_data
69 int ut_fd;
70 off_t loc_utmp;
71 struct utmp ubuf;
75 /* Reentrent versions of the file for handling utmp files. */
76 extern int getutent_r __P ((struct utmp **__utmp,
77 struct utmp_data *__utmp_data));
79 extern void setutent_r __P ((struct utmp_data *__utmp_data));
81 extern void endutent_r __P ((struct utmp_data *__utmp_data));
83 extern int getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
84 struct utmp_data *__utmp_data));
86 extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
87 struct utmp_data *__utmp_data));
89 extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
90 struct utmp_data *__utmp_data));
92 #endif /* Use reentrant. */
94 __END_DECLS
96 #endif /* utmp.h */