Update.
[glibc.git] / sysdeps / gnu / bits / utmp.h
blob163f6427ec9608523eed7a2b8a98f0c4de202964
1 /* The `struct utmp' type, describing entries in the utmp file. GNU version.
2 Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _UTMP_H
20 #error "Never use <bits/utmp.h> directly; include <utmpx.h> instead."
21 #endif
23 #include <paths.h>
24 #include <sys/time.h>
25 #include <sys/types.h>
28 #define UT_LINESIZE 32
29 #define UT_NAMESIZE 32
30 #define UT_HOSTSIZE 256
33 /* The structure describing an entry in the database of
34 previous logins. */
35 struct lastlog
37 time_t ll_time;
38 char ll_line[UT_LINESIZE];
39 char ll_host[UT_HOSTSIZE];
43 /* The structure describing the status of a terminated process. This
44 type is used in `struct utmp' below. */
45 struct exit_status
47 short int e_termination; /* Process termination status. */
48 short int e_exit; /* Process exit status. */
52 /* The structure describing an entry in the user accounting database. */
53 struct utmp
55 short int ut_type; /* Type of login. */
56 pid_t ut_pid; /* Process ID of login process. */
57 char ut_line[UT_LINESIZE]; /* Devicename. */
58 char ut_id[4]; /* Inittab ID. */
59 char ut_user[UT_NAMESIZE]; /* Username. */
60 char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
61 struct exit_status ut_exit; /* Exit status of a process marked
62 as DEAD_PROCESS. */
63 long ut_session; /* Session ID, used for windowing. */
64 struct timeval ut_tv; /* Time entry was made. */
65 int32_t ut_addr_v6[4]; /* Internet address of remote host. */
66 char pad[20]; /* Reserved for future use. */
69 /* Backwards compatibility hacks. */
70 #define ut_name ut_user
71 #ifndef _NO_UT_TIME
72 /* We have a problem here: `ut_time' is also used otherwise. Define
73 _NO_UT_TIME if the compiler complains. */
74 # define ut_time ut_tv.tv_sec
75 #endif
76 #define ut_xtime ut_tv.tv_sec
77 #define ut_addr ut_addr_v6[0]
80 /* Values for the `ut_type' field of a `struct utmp'. */
81 #define EMPTY 0 /* No valid user accounting information. */
83 #define RUN_LVL 1 /* The system's runlevel. */
84 #define BOOT_TIME 2 /* Time of system boot. */
85 #define NEW_TIME 3 /* Time after system clock changed. */
86 #define OLD_TIME 4 /* Time when system clock changed. */
88 #define INIT_PROCESS 5 /* Process spawned by the init process. */
89 #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
90 #define USER_PROCESS 7 /* Normal process. */
91 #define DEAD_PROCESS 8 /* Terminated process. */
93 #define ACCOUNTING 9
95 /* Old Linux name for the EMPTY type. */
96 #define UT_UNKNOWN EMPTY
99 /* Tell the user that we have a modern system with UT_HOST, UT_PID,
100 UT_TYPE, UT_ID and UT_TV fields. */
101 #define _HAVE_UT_TYPE 1
102 #define _HAVE_UT_PID 1
103 #define _HAVE_UT_ID 1
104 #define _HAVE_UT_TV 1
105 #define _HAVE_UT_HOST 1