blob: 10b75c9a0bde17c46fa70bca329cf3a1eb56d1be [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* Copyright (C) 1993, 1996, 1997, 1998, 1999 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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
18
19#ifndef _UTMP_H
20#define _UTMP_H 1
21
22#include <features.h>
23
24#include <sys/types.h>
25
26
27__BEGIN_DECLS
28
29/* Get system dependent values and data structures. */
30#include <bits/utmp.h>
31
32/* Compatibility names for the strings of the canonical file names. */
33#define UTMP_FILE _PATH_UTMP
34#define UTMP_FILENAME _PATH_UTMP
35#define WTMP_FILE _PATH_WTMP
36#define WTMP_FILENAME _PATH_WTMP
37
38
39
40#ifdef __UCLIBC_HAS_LIBUTIL__
41/* Make FD be the controlling terminal, stdin, stdout, and stderr;
42 then close FD. Returns 0 on success, nonzero on error. */
43extern int login_tty (int __fd) __THROW;
44
45
46/* Write the given entry into utmp and wtmp. */
47extern void login (__const struct utmp *__entry) __THROW;
48
49/* Write the utmp entry to say the user on UT_LINE has logged out. */
50extern int logout (__const char *__ut_line) __THROW;
51
52/* Append to wtmp an entry for the current time and the given info. */
53extern void logwtmp (__const char *__ut_line, __const char *__ut_name,
54 __const char *__ut_host) __THROW;
55#endif
56
57/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
58extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp)
59 __THROW;
60libc_hidden_proto(updwtmp)
61
62/* Change name of the utmp file to be examined. */
63extern int utmpname (__const char *__file) __THROW;
64libc_hidden_proto(utmpname)
65
66/* Read next entry from a utmp-like file. */
67extern struct utmp *getutent (void) __THROW;
68libc_hidden_proto(getutent)
69
70/* Reset the input stream to the beginning of the file. */
71extern void setutent (void) __THROW;
72libc_hidden_proto(setutent)
73
74/* Close the current open file. */
75extern void endutent (void) __THROW;
76libc_hidden_proto(endutent)
77
78/* Search forward from the current point in the utmp file until the
79 next entry with a ut_type matching ID->ut_type. */
80extern struct utmp *getutid (__const struct utmp *__id) __THROW;
81libc_hidden_proto(getutid)
82
83/* Search forward from the current point in the utmp file until the
84 next entry with a ut_line matching LINE->ut_line. */
85extern struct utmp *getutline (__const struct utmp *__line) __THROW;
86libc_hidden_proto(getutline)
87
88/* Write out entry pointed to by UTMP_PTR into the utmp file. */
89extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW;
90libc_hidden_proto(pututline)
91
92
93#if 0 /* def __USE_MISC */
94/* Reentrant versions of the file for handling utmp files. */
95extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
96
97extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer,
98 struct utmp **__result) __THROW;
99
100extern int getutline_r (__const struct utmp *__line,
101 struct utmp *__buffer, struct utmp **__result) __THROW;
102
103#endif /* Use misc. */
104
105__END_DECLS
106
107#endif /* utmp.h */