]> git.ipfire.org Git - thirdparty/glibc.git/blame - login/utmp.h
elf: Use nocancel pread64() instead of lseek()+read()
[thirdparty/glibc.git] / login / utmp.h
CommitLineData
04277e02 1/* Copyright (C) 1993-2019 Free Software Foundation, Inc.
84384f5b 2 This file is part of the GNU C Library.
b8fe19fa 3
84384f5b 4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
b8fe19fa 8
84384f5b
UD
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
41bdb6e2 12 Lesser General Public License for more details.
b8fe19fa 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
b8fe19fa 17
5107cf1d
UD
18#ifndef _UTMP_H
19#define _UTMP_H 1
b8fe19fa 20
b8fe19fa
RM
21#include <features.h>
22
23#include <sys/types.h>
24
51fbd1f6 25
1fb05e3d
UD
26__BEGIN_DECLS
27
b8fe19fa 28/* Get system dependent values and data structures. */
5107cf1d 29#include <bits/utmp.h>
b8fe19fa 30
4f54cdb1
RM
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
b8fe19fa 38
51fbd1f6
RM
39/* Make FD be the controlling terminal, stdin, stdout, and stderr;
40 then close FD. Returns 0 on success, nonzero on error. */
c1422e5b 41extern int login_tty (int __fd) __THROW;
51fbd1f6
RM
42
43
b8fe19fa 44/* Write the given entry into utmp and wtmp. */
a784e502 45extern void login (const struct utmp *__entry) __THROW;
b8fe19fa
RM
46
47/* Write the utmp entry to say the user on UT_LINE has logged out. */
a784e502 48extern int logout (const char *__ut_line) __THROW;
b8fe19fa
RM
49
50/* Append to wtmp an entry for the current time and the given info. */
a784e502
UD
51extern void logwtmp (const char *__ut_line, const char *__ut_name,
52 const char *__ut_host) __THROW;
b8fe19fa 53
76b87c03 54/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
a784e502 55extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
c1422e5b 56 __THROW;
76b87c03 57
51fbd1f6 58/* Change name of the utmp file to be examined. */
a784e502 59extern int utmpname (const char *__file) __THROW;
b8fe19fa
RM
60
61/* Read next entry from a utmp-like file. */
c1422e5b 62extern struct utmp *getutent (void) __THROW;
b8fe19fa 63
76b87c03 64/* Reset the input stream to the beginning of the file. */
c1422e5b 65extern void setutent (void) __THROW;
b8fe19fa
RM
66
67/* Close the current open file. */
c1422e5b 68extern void endutent (void) __THROW;
b8fe19fa
RM
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. */
a784e502 72extern struct utmp *getutid (const struct utmp *__id) __THROW;
b8fe19fa
RM
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. */
a784e502 76extern struct utmp *getutline (const struct utmp *__line) __THROW;
b8fe19fa
RM
77
78/* Write out entry pointed to by UTMP_PTR into the utmp file. */
a784e502 79extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
b8fe19fa
RM
80
81
19361cb7 82#ifdef __USE_MISC
dbe31b9a 83/* Reentrant versions of the file for handling utmp files. */
c1422e5b 84extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
b8fe19fa 85
a784e502 86extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
c1422e5b 87 struct utmp **__result) __THROW;
b8fe19fa 88
a784e502 89extern int getutline_r (const struct utmp *__line,
c1422e5b 90 struct utmp *__buffer, struct utmp **__result) __THROW;
b8fe19fa 91
19361cb7 92#endif /* Use misc. */
b8fe19fa
RM
93
94__END_DECLS
95
96#endif /* utmp.h */