Update.
[glibc.git] / sysdeps / unix / sysv / linux / sparc / bits / utmp.h
blob13b8fdc23747a9457f04014088ea193a9a4e29a5
1 /* The `struct utmp' type, describing entries in the utmp file. GNU version.
2 Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifndef _UTMP_H
22 # error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
23 #endif
25 #include <paths.h>
26 #include <sys/time.h>
27 #include <sys/types.h>
28 #include <bits/wordsize.h>
31 #define UT_LINESIZE 32
32 #define UT_NAMESIZE 32
33 #define UT_HOSTSIZE 256
36 /* The structure describing an entry in the database of
37 previous logins. */
38 struct lastlog
40 #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
41 int32_t_t ll_time;
42 #else
43 __time_t ll_time;
44 #endif
45 char ll_line[UT_LINESIZE];
46 char ll_host[UT_HOSTSIZE];
50 /* The structure describing the status of a terminated process. This
51 type is used in `struct utmp' below. */
52 struct exit_status
54 short int e_termination; /* Process termination status. */
55 short int e_exit; /* Process exit status. */
59 /* The structure describing an entry in the user accounting database. */
60 struct utmp
62 short int ut_type; /* Type of login. */
63 pid_t ut_pid; /* Process ID of login process. */
64 char ut_line[UT_LINESIZE]; /* Devicename. */
65 char ut_id[4]; /* Inittab ID. */
66 char ut_user[UT_NAMESIZE]; /* Username. */
67 char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
68 struct exit_status ut_exit; /* Exit status of a process marked
69 as DEAD_PROCESS. */
71 /* The fields ut_session and ut_tv must be the same size when compiled
72 32- and 64-bit. This allows files and shared memory to be shared
73 between 32/64bit applications. For example /var/run/utmp. */
74 #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
75 int32_t ut_session; /* Session ID, used for windowing. */
76 struct
78 int32_t tv_sec; /* Seconds. */
79 int32_t tv_usec; /* Microseconds. */
80 } ut_tv; /* Time entry was made. */
81 #else
82 long int ut_session; /* Session ID, used for windowing. */
83 struct timeval ut_tv; /* Time entry was made. */
84 #endif
86 int32_t ut_addr_v6[4]; /* Internet address of remote host. */
87 char __unused[20]; /* Reserved for future use. */
90 /* Backwards compatibility hacks. */
91 #define ut_name ut_user
92 #ifndef _NO_UT_TIME
93 /* We have a problem here: `ut_time' is also used otherwise. Define
94 _NO_UT_TIME if the compiler complains. */
95 # define ut_time ut_tv.tv_sec
96 #endif
97 #define ut_xtime ut_tv.tv_sec
98 #define ut_addr ut_addr_v6[0]
101 /* Values for the `ut_type' field of a `struct utmp'. */
102 #define EMPTY 0 /* No valid user accounting information. */
104 #define RUN_LVL 1 /* The system's runlevel. */
105 #define BOOT_TIME 2 /* Time of system boot. */
106 #define NEW_TIME 3 /* Time after system clock changed. */
107 #define OLD_TIME 4 /* Time when system clock changed. */
109 #define INIT_PROCESS 5 /* Process spawned by the init process. */
110 #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
111 #define USER_PROCESS 7 /* Normal process. */
112 #define DEAD_PROCESS 8 /* Terminated process. */
114 #define ACCOUNTING 9
116 /* Old Linux name for the EMPTY type. */
117 #define UT_UNKNOWN EMPTY
120 /* Tell the user that we have a modern system with UT_HOST, UT_PID,
121 UT_TYPE, UT_ID and UT_TV fields. */
122 #define _HAVE_UT_TYPE 1
123 #define _HAVE_UT_PID 1
124 #define _HAVE_UT_ID 1
125 #define _HAVE_UT_TV 1
126 #define _HAVE_UT_HOST 1