]> git.ipfire.org Git - thirdparty/glibc.git/blob - login/utmp.h
Fri Jun 21 00:27:51 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
[thirdparty/glibc.git] / login / utmp.h
1 /* Copyright (C) 1993, 1996 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 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.
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 Library General Public License for more details.
13
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. */
18
19
20 #ifndef _UTMP_H_
21
22 #define _UTMP_H_ 1
23 #include <features.h>
24
25 #include <sys/types.h>
26
27
28 /* Get system dependent values and data structures. */
29 #include <utmpbits.h>
30
31
32 /* Make FD be the controlling terminal, stdin, stdout, and stderr;
33 then close FD. Returns 0 on success, nonzero on error. */
34 extern int login_tty __P ((int fd));
35
36
37 /* Write the given entry into utmp and wtmp. */
38 extern void login __P ((__const struct utmp *));
39
40 /* Write the utmp entry to say the user on UT_LINE has logged out. */
41 extern int logout __P ((__const char *ut_line));
42
43 /* Append to wtmp an entry for the current time and the given info. */
44 extern void logwtmp __P ((__const char *ut_line, __const char *ut_name,
45 __const char *ut_host));
46
47 /* Change name of the utmp file to be examined. */
48 extern int utmpname __P ((__const char *__file));
49
50 /* Read next entry from a utmp-like file. */
51 extern struct utmp *getutent __P ((void));
52
53 /* Rest the input stream to the beginning of the file. */
54 extern void setutent __P ((void));
55
56 /* Close the current open file. */
57 extern void endutent __P ((void));
58
59 /* Search forward from the current point in the utmp file until the
60 next entry with a ut_type matching ID->ut_type. */
61 extern struct utmp *getutid __P ((__const struct utmp *__id));
62
63 /* Search forward from the current point in the utmp file until the
64 next entry with a ut_line matching LINE->ut_line. */
65 extern struct utmp *getutline __P ((__const struct utmp *__line));
66
67 /* Write out entry pointed to by UTMP_PTR into the utmp file. */
68 extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
69
70
71 #ifdef __USE_REENTRANT
72 /* Define the data structure needed for the reentrent version. */
73 struct utmp_data
74 {
75 int ut_fd;
76 off_t loc_utmp;
77 struct utmp ubuf;
78 };
79
80
81 /* Reentrent versions of the file for handling utmp files. */
82 extern int getutent_r __P ((struct utmp **__utmp,
83 struct utmp_data *__utmp_data));
84
85 extern void setutent_r __P ((struct utmp_data *__utmp_data));
86
87 extern void endutent_r __P ((struct utmp_data *__utmp_data));
88
89 extern int getutid_r __P ((__const struct utmp *__id, struct utmp **__utmp,
90 struct utmp_data *__utmp_data));
91
92 extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
93 struct utmp_data *__utmp_data));
94
95 extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
96 struct utmp_data *__utmp_data));
97
98 #endif /* Use reentrant. */
99
100 __END_DECLS
101
102 #endif /* utmp.h */