Few last minute patches from main on 960811
[glibc/history.git] / login / utmp.h
blob76870f68ef07eb69f5cc45e56f96bba981fa2c2a
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>
28 /* Get system dependent values and data structures. */
29 #include <utmpbits.h>
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
39 /* Make FD be the controlling terminal, stdin, stdout, and stderr;
40 then close FD. Returns 0 on success, nonzero on error. */
41 extern int login_tty __P ((int fd));
44 /* Write the given entry into utmp and wtmp. */
45 extern void login __P ((__const struct utmp *));
47 /* Write the utmp entry to say the user on UT_LINE has logged out. */
48 extern int logout __P ((__const char *ut_line));
50 /* Append to wtmp an entry for the current time and the given info. */
51 extern void logwtmp __P ((__const char *ut_line, __const char *ut_name,
52 __const char *ut_host));
54 /* Change name of the utmp file to be examined. */
55 extern int utmpname __P ((__const char *__file));
57 /* Read next entry from a utmp-like file. */
58 extern struct utmp *getutent __P ((void));
60 /* Rest the input stream to the beginning of the file. */
61 extern void setutent __P ((void));
63 /* Close the current open file. */
64 extern void endutent __P ((void));
66 /* Search forward from the current point in the utmp file until the
67 next entry with a ut_type matching ID->ut_type. */
68 extern struct utmp *getutid __P ((__const struct utmp *__id));
70 /* Search forward from the current point in the utmp file until the
71 next entry with a ut_line matching LINE->ut_line. */
72 extern struct utmp *getutline __P ((__const struct utmp *__line));
74 /* Write out entry pointed to by UTMP_PTR into the utmp file. */
75 extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
78 #ifdef __USE_REENTRANT
79 /* Define the data structure needed for the reentrant version. */
80 struct utmp_data
82 int ut_fd;
83 off_t loc_utmp;
84 struct utmp ubuf;
88 /* Reentrant versions of the file for handling utmp files. */
89 extern int __getutent_r __P ((struct utmp **__utmp,
90 struct utmp_data *__utmp_data));
91 extern int getutent_r __P ((struct utmp **__utmp,
92 struct utmp_data *__utmp_data));
94 extern void __setutent_r __P ((struct utmp_data *__utmp_data));
95 extern void setutent_r __P ((struct utmp_data *__utmp_data));
97 extern void __endutent_r __P ((struct utmp_data *__utmp_data));
98 extern void endutent_r __P ((struct utmp_data *__utmp_data));
100 extern int __getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
101 struct utmp_data *__utmp_data));
102 extern int getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
103 struct utmp_data *__utmp_data));
105 extern int __getutline_r __P ((__const struct utmp *__line,
106 struct utmp **__utmp,
107 struct utmp_data *__utmp_data));
108 extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
109 struct utmp_data *__utmp_data));
111 extern int __pututline_r __P ((__const struct utmp *__utmp_ptr,
112 struct utmp_data *__utmp_data));
113 extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
114 struct utmp_data *__utmp_data));
116 #endif /* Use reentrant. */
118 __END_DECLS
120 #endif /* utmp.h */