]>
Commit | Line | Data |
---|---|---|
a33b817f | 1 | /* The `struct utmp' type, describing entries in the utmp file. |
dff8da6b | 2 | Copyright (C) 1993-2024 Free Software Foundation, Inc. |
41bdb6e2 | 3 | This file is part of the GNU C Library. |
b8fe19fa | 4 | |
84384f5b | 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. | |
b8fe19fa | 9 | |
84384f5b UD |
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. |
b8fe19fa | 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/>. */ |
b8fe19fa | 18 | |
5107cf1d | 19 | #ifndef _UTMP_H |
f4017d20 | 20 | # error "Never include <bits/utmp.h> directly; use <utmp.h> instead." |
5107cf1d UD |
21 | #endif |
22 | ||
84384f5b | 23 | #include <paths.h> |
a33b817f FW |
24 | #include <sys/time.h> |
25 | #include <sys/types.h> | |
26 | #include <bits/wordsize.h> | |
b8fe19fa | 27 | |
b8fe19fa | 28 | |
a33b817f FW |
29 | #define UT_LINESIZE 32 |
30 | #define UT_NAMESIZE 32 | |
31 | #define UT_HOSTSIZE 256 | |
b8fe19fa | 32 | |
b8fe19fa | 33 | |
a33b817f FW |
34 | /* The structure describing an entry in the database of |
35 | previous logins. */ | |
0413b54c UD |
36 | struct lastlog |
37 | { | |
a33b817f | 38 | #if __WORDSIZE_TIME64_COMPAT32 |
5361ad39 | 39 | __uint32_t ll_time; |
a33b817f FW |
40 | #else |
41 | __time_t ll_time; | |
42 | #endif | |
0413b54c UD |
43 | char ll_line[UT_LINESIZE]; |
44 | char ll_host[UT_HOSTSIZE]; | |
45 | }; | |
b8fe19fa | 46 | |
a33b817f FW |
47 | |
48 | /* The structure describing the status of a terminated process. This | |
49 | type is used in `struct utmp' below. */ | |
50 | struct exit_status | |
0413b54c | 51 | { |
a33b817f FW |
52 | short int e_termination; /* Process termination status. */ |
53 | short int e_exit; /* Process exit status. */ | |
0413b54c | 54 | }; |
b8fe19fa | 55 | |
4f54cdb1 | 56 | |
a33b817f FW |
57 | /* The structure describing an entry in the user accounting database. */ |
58 | struct utmp | |
59 | { | |
60 | short int ut_type; /* Type of login. */ | |
61 | pid_t ut_pid; /* Process ID of login process. */ | |
62 | char ut_line[UT_LINESIZE] | |
63 | __attribute_nonstring__; /* Devicename. */ | |
c2adefba FW |
64 | char ut_id[4] |
65 | __attribute_nonstring__; /* Inittab ID. */ | |
a33b817f FW |
66 | char ut_user[UT_NAMESIZE] |
67 | __attribute_nonstring__; /* Username. */ | |
68 | char ut_host[UT_HOSTSIZE] | |
69 | __attribute_nonstring__; /* Hostname for remote login. */ | |
70 | struct exit_status ut_exit; /* Exit status of a process marked | |
71 | as DEAD_PROCESS. */ | |
72 | /* The ut_session and ut_tv fields must be the same size when compiled | |
73 | 32- and 64-bit. This allows data files and shared memory to be | |
74 | shared between 32- and 64-bit applications. */ | |
75 | #if __WORDSIZE_TIME64_COMPAT32 | |
76 | int32_t ut_session; /* Session ID, used for windowing. */ | |
77 | struct | |
78 | { | |
5361ad39 | 79 | __uint32_t tv_sec; /* Seconds. */ |
a33b817f FW |
80 | int32_t tv_usec; /* Microseconds. */ |
81 | } ut_tv; /* Time entry was made. */ | |
82 | #else | |
83 | long int ut_session; /* Session ID, used for windowing. */ | |
84 | struct timeval ut_tv; /* Time entry was made. */ | |
85 | #endif | |
86 | ||
87 | int32_t ut_addr_v6[4]; /* Internet address of remote host. */ | |
88 | char __glibc_reserved[20]; /* Reserved for future use. */ | |
89 | }; | |
90 | ||
91 | /* Backwards compatibility hacks. */ | |
92 | #define ut_name ut_user | |
93 | #ifndef _NO_UT_TIME | |
94 | /* We have a problem here: `ut_time' is also used otherwise. Define | |
95 | _NO_UT_TIME if the compiler complains. */ | |
96 | # define ut_time ut_tv.tv_sec | |
97 | #endif | |
98 | #define ut_xtime ut_tv.tv_sec | |
99 | #define ut_addr ut_addr_v6[0] | |
100 | ||
101 | ||
102 | /* Values for the `ut_type' field of a `struct utmp'. */ | |
103 | #define EMPTY 0 /* No valid user accounting information. */ | |
104 | ||
105 | #define RUN_LVL 1 /* The system's runlevel. */ | |
106 | #define BOOT_TIME 2 /* Time of system boot. */ | |
107 | #define NEW_TIME 3 /* Time after system clock changed. */ | |
108 | #define OLD_TIME 4 /* Time when system clock changed. */ | |
109 | ||
110 | #define INIT_PROCESS 5 /* Process spawned by the init process. */ | |
111 | #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ | |
112 | #define USER_PROCESS 7 /* Normal process. */ | |
113 | #define DEAD_PROCESS 8 /* Terminated process. */ | |
114 | ||
115 | #define ACCOUNTING 9 | |
116 | ||
117 | /* Old Linux name for the EMPTY type. */ | |
118 | #define UT_UNKNOWN EMPTY | |
119 | ||
120 | ||
121 | /* Tell the user that we have a modern system with UT_HOST, UT_PID, | |
122 | UT_TYPE, UT_ID and UT_TV fields. */ | |
123 | #define _HAVE_UT_TYPE 1 | |
124 | #define _HAVE_UT_PID 1 | |
125 | #define _HAVE_UT_ID 1 | |
126 | #define _HAVE_UT_TV 1 | |
127 | #define _HAVE_UT_HOST 1 |