1/* Copyright (C) 1993-2022 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 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.
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 Lesser General Public License for more details.
13
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 <https://www.gnu.org/licenses/>. */
17
18#ifndef _UTMP_H
19#define _UTMP_H 1
20
21#include <features.h>
22
23#include <sys/types.h>
24
25
26__BEGIN_DECLS
27
28/* Get system dependent values and data structures. */
29#include <bits/utmp.h>
30
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
36
37
38
39/* Make FD be the controlling terminal, stdin, stdout, and stderr;
40 then close FD. Returns 0 on success, nonzero on error. */
41extern int login_tty (int __fd) __THROW;
42
43
44/* Write the given entry into utmp and wtmp. */
45extern void login (const struct utmp *__entry) __THROW;
46
47/* Write the utmp entry to say the user on UT_LINE has logged out. */
48extern int logout (const char *__ut_line) __THROW;
49
50/* Append to wtmp an entry for the current time and the given info. */
51extern void logwtmp (const char *__ut_line, const char *__ut_name,
52 const char *__ut_host) __THROW;
53
54/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
55extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
56 __THROW;
57
58/* Change name of the utmp file to be examined. */
59extern int utmpname (const char *__file) __THROW;
60
61/* Read next entry from a utmp-like file. */
62extern struct utmp *getutent (void) __THROW;
63
64/* Reset the input stream to the beginning of the file. */
65extern void setutent (void) __THROW;
66
67/* Close the current open file. */
68extern void endutent (void) __THROW;
69
70/* Search forward from the current point in the utmp file until the
71 next entry with a ut_type matching ID->ut_type. */
72extern struct utmp *getutid (const struct utmp *__id) __THROW;
73
74/* Search forward from the current point in the utmp file until the
75 next entry with a ut_line matching LINE->ut_line. */
76extern struct utmp *getutline (const struct utmp *__line) __THROW;
77
78/* Write out entry pointed to by UTMP_PTR into the utmp file. */
79extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
80
81
82#ifdef __USE_MISC
83/* Reentrant versions of the file for handling utmp files. */
84extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
85
86extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
87 struct utmp **__result) __THROW;
88
89extern int getutline_r (const struct utmp *__line,
90 struct utmp *__buffer, struct utmp **__result) __THROW;
91
92#endif /* Use misc. */
93
94__END_DECLS
95
96#endif /* utmp.h */
97

source code of glibc/login/utmp.h