]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/gnu/bits/utmpx.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / gnu / bits / utmpx.h
CommitLineData
2aa15430 1/* Structures and definitions for the user accounting database. GNU version.
2b778ceb 2 Copyright (C) 1997-2021 Free Software Foundation, Inc.
41bdb6e2 3 This file is part of the GNU C Library.
f21acc89
UD
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
f21acc89
UD
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
f21acc89 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
f21acc89
UD
18
19#ifndef _UTMPX_H
f4017d20 20# error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
f21acc89
UD
21#endif
22
23#include <bits/types.h>
24#include <sys/time.h>
c55dca8d 25#include <bits/wordsize.h>
f21acc89
UD
26
27
8619129f
UD
28#ifdef __USE_GNU
29# include <paths.h>
30# define _PATH_UTMPX _PATH_UTMP
31# define _PATH_WTMPX _PATH_WTMP
32#endif
33
34
f21acc89
UD
35#define __UT_LINESIZE 32
36#define __UT_NAMESIZE 32
37#define __UT_HOSTSIZE 256
38
f4017d20 39
f21acc89
UD
40/* The structure describing the status of a terminated process. This
41 type is used in `struct utmpx' below. */
42struct __exit_status
f4017d20 43 {
31604a65
UD
44#ifdef __USE_GNU
45 short int e_termination; /* Process termination status. */
46 short int e_exit; /* Process exit status. */
47#else
d2537a47
UD
48 short int __e_termination; /* Process termination status. */
49 short int __e_exit; /* Process exit status. */
31604a65 50#endif
f4017d20 51 };
f21acc89
UD
52
53
54/* The structure describing an entry in the user accounting database. */
55struct utmpx
56{
57 short int ut_type; /* Type of login. */
58 __pid_t ut_pid; /* Process ID of login process. */
c2adefba
FW
59 char ut_line[__UT_LINESIZE]
60 __attribute_nonstring__; /* Devicename. */
61 char ut_id[4]
62 __attribute_nonstring__; /* Inittab ID. */
63 char ut_user[__UT_NAMESIZE]
64 __attribute_nonstring__; /* Username. */
65 char ut_host[__UT_HOSTSIZE]
66 __attribute_nonstring__; /* Hostname for remote login. */
f21acc89
UD
67 struct __exit_status ut_exit; /* Exit status of a process marked
68 as DEAD_PROCESS. */
c55dca8d
RM
69
70/* The fields ut_session and ut_tv must be the same size when compiled
71 32- and 64-bit. This allows files and shared memory to be shared
72 between 32- and 64-bit applications. */
d060cd00 73#if __WORDSIZE_TIME64_COMPAT32
c55dca8d
RM
74 __int32_t ut_session; /* Session ID, used for windowing. */
75 struct
76 {
77 __int32_t tv_sec; /* Seconds. */
78 __int32_t tv_usec; /* Microseconds. */
79 } ut_tv; /* Time entry was made. */
80#else
f4017d20 81 long int ut_session; /* Session ID, used for windowing. */
f21acc89 82 struct timeval ut_tv; /* Time entry was made. */
c55dca8d 83#endif
f21acc89 84 __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
d1d9eaf4 85 char __glibc_reserved[20]; /* Reserved for future use. */
f21acc89
UD
86};
87
88
8619129f 89/* Values for the `ut_type' field of a `struct utmpx'. */
f21acc89
UD
90#define EMPTY 0 /* No valid user accounting information. */
91
73b6bffc
UD
92#ifdef __USE_GNU
93# define RUN_LVL 1 /* The system's runlevel. */
94#endif
f21acc89
UD
95#define BOOT_TIME 2 /* Time of system boot. */
96#define NEW_TIME 3 /* Time after system clock changed. */
97#define OLD_TIME 4 /* Time when system clock changed. */
98
99#define INIT_PROCESS 5 /* Process spawned by the init process. */
100#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
101#define USER_PROCESS 7 /* Normal process. */
102#define DEAD_PROCESS 8 /* Terminated process. */
8619129f
UD
103
104#ifdef __USE_GNU
105# define ACCOUNTING 9 /* System accounting. */
106#endif