MIPS: Consolidate nptl/ subdirectories under linux/...
[glibc.git] / login / utmp.h
blob6f1094b2aa3e0331c6f5d7fa014d0cb330ff1ea9
1 /* Copyright (C) 1993-2014 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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _UTMP_H
19 #define _UTMP_H 1
21 #include <features.h>
23 #include <sys/types.h>
26 __BEGIN_DECLS
28 /* Get system dependent values and data structures. */
29 #include <bits/utmp.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 (int __fd) __THROW;
44 /* Write the given entry into utmp and wtmp. */
45 extern void login (const struct utmp *__entry) __THROW;
47 /* Write the utmp entry to say the user on UT_LINE has logged out. */
48 extern int logout (const char *__ut_line) __THROW;
50 /* Append to wtmp an entry for the current time and the given info. */
51 extern void logwtmp (const char *__ut_line, const char *__ut_name,
52 const char *__ut_host) __THROW;
54 /* Append entry UTMP to the wtmp-like file WTMP_FILE. */
55 extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
56 __THROW;
58 /* Change name of the utmp file to be examined. */
59 extern int utmpname (const char *__file) __THROW;
61 /* Read next entry from a utmp-like file. */
62 extern struct utmp *getutent (void) __THROW;
64 /* Reset the input stream to the beginning of the file. */
65 extern void setutent (void) __THROW;
67 /* Close the current open file. */
68 extern void endutent (void) __THROW;
70 /* Search forward from the current point in the utmp file until the
71 next entry with a ut_type matching ID->ut_type. */
72 extern struct utmp *getutid (const struct utmp *__id) __THROW;
74 /* Search forward from the current point in the utmp file until the
75 next entry with a ut_line matching LINE->ut_line. */
76 extern struct utmp *getutline (const struct utmp *__line) __THROW;
78 /* Write out entry pointed to by UTMP_PTR into the utmp file. */
79 extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
82 #ifdef __USE_MISC
83 /* Reentrant versions of the file for handling utmp files. */
84 extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
86 extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
87 struct utmp **__result) __THROW;
89 extern int getutline_r (const struct utmp *__line,
90 struct utmp *__buffer, struct utmp **__result) __THROW;
92 #endif /* Use misc. */
94 __END_DECLS
96 #endif /* utmp.h */