Update.
[glibc.git] / sysdeps / gnu / utmpbits.h
blobdb49ac845c472b8d13d4c88caf473d73c439f115
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 _UTMPBITS_H
21 #define _UTMPBITS_H 1
22 #include <features.h>
24 #include <paths.h>
25 #include <sys/time.h>
26 #include <sys/types.h>
29 #define UT_UNKNOWN 0 /* for ut_type field */
31 #define RUN_LVL 1
32 #define BOOT_TIME 2
33 #define NEW_TIME 3
34 #define OLD_TIME 4
36 #define INIT_PROCESS 5
37 #define LOGIN_PROCESS 6
38 #define USER_PROCESS 7
39 #define DEAD_PROCESS 8
40 #define ACCOUNTING 9
42 #define UT_LINESIZE 32
43 #define UT_NAMESIZE 32
44 #define UT_HOSTSIZE 256
46 __BEGIN_DECLS
48 struct lastlog
50 time_t ll_time;
51 char ll_line[UT_LINESIZE];
52 char ll_host[UT_HOSTSIZE];
56 /* XXX We are not ready to use this now. It needs some more research.
57 Simly copying the behaviour of other implementations is no big
58 help. */
59 #if 0
60 /* Which program created the record. */
61 enum utlogin
63 unknown,
65 local,
66 rlogin,
67 telnet,
68 rsh,
69 ftp,
70 screen,
71 splitvt,
72 xterm
73 /* More could be added here. */
75 #endif
78 struct exit_status
80 short int e_termination; /* Process termination status. */
81 short int e_exit; /* Process exit status. */
85 struct utmp
87 short int ut_type; /* Type of login. */
88 pid_t ut_pid; /* Pid of login process. */
89 char ut_line[UT_LINESIZE]; /* NUL-terminated devicename of tty. */
90 char ut_id[4]; /* Inittab id. */
91 char ut_user[UT_NAMESIZE]; /* Username (not NUL terminated). */
92 #define ut_name ut_user /* Compatible field name for same. */
93 char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
94 struct exit_status ut_exit; /* The exit status of a process marked
95 as DEAD_PROCESS. */
96 long ut_session; /* Session ID, used for windowing. */
97 struct timeval ut_tv; /* Time entry was made. */
98 int32_t ut_addr_v6[4]; /* Internet address of remote host. */
99 char pad[20]; /* Reserved for future use. */
102 /* Backwards compatibility hacks. */
103 #ifndef _NO_UT_TIME
104 /* We have a problem here: `ut_time' is also used otherwise. Define
105 _NO_UT_TIME if the compiler complains. */
106 # define ut_time ut_tv.tv_sec
107 #endif
108 #define ut_xtime ut_tv.tv_sec
109 #define ut_addr ut_addr_v6[0]
111 /* Tell the user that we have a modern system with UT_HOST, UT_PID,
112 UT_TYPE, UT_ID and UT_TV fields. */
113 #define _HAVE_UT_TYPE 1
114 #define _HAVE_UT_PID 1
115 #define _HAVE_UT_ID 1
116 #define _HAVE_UT_TV 1
117 #define _HAVE_UT_HOST 1
119 __END_DECLS
121 #endif /* !_UTMP_H_ */