Wed May 29 00:57:37 1996 David Mosberger-Tang <davidm@azstarnet.com>
[platform/upstream/glibc.git] / sysdeps / gnu / utmpbits.h
1 /* The `struct utmp' type, describing entries in the utmp file.  GNU version.
2 Copyright (C) 1993, 1996 Free Software Foundation, Inc.
3
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.
8
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.
13
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
16 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.  */
18
19 #ifndef _UTMPBITS_H
20
21 #define _UTMPBITS_H     1
22 #include <features.h>
23
24 #include <sys/time.h>
25 #include <sys/types.h>
26
27 #define _PATH_UTMP      "/var/run/utmp"
28 #define _PATH_WTMP      "/var/log/wtmp"
29 #define _PATH_LASTLOG   "/var/log/lastlog"
30
31 #define UTMP_FILE       _PATH_UTMP
32 #define WTMP_FILE       _PATH_WTMP
33 #define UTMP_FILENAME   UTMP_FILE
34 #define WTMP_FILENAME   WTMP_FILE
35
36 #define UT_UNKNOWN      0       /* for ut_type field */
37
38 #define RUN_LVL         1
39 #define BOOT_TIME       2
40 #define NEW_TIME        3
41 #define OLD_TIME        4
42
43 #define INIT_PROCESS    5
44 #define LOGIN_PROCESS   6
45 #define USER_PROCESS    7
46 #define DEAD_PROCESS    8
47
48 #define ut_name ut_user
49
50 #define UT_LINESIZE     32
51 #define UT_NAMESIZE     32
52 #define UT_HOSTSIZE     256
53
54 __BEGIN_DECLS
55
56 struct lastlog
57 {
58   time_t ll_time;
59   char ll_line[UT_LINESIZE];
60   char ll_host[UT_HOSTSIZE];
61 };
62
63 struct utmp
64 {
65   short int ut_type;            /* Type of login.  */
66   pid_t ut_pid;                 /* Pid of login process.  */
67   char ut_line[UT_LINESIZE];    /* NUL-terminated devicename of tty.  */
68   char ut_id[4];                /* Inittab id. */
69   char ut_user[UT_NAMESIZE];    /* Username (not NUL terminated).  */
70   char ut_host[UT_HOSTSIZE];    /* Hostname for remote login.  */
71   int ut_exit;                  /* Process termination/exit status.  */
72   long ut_session;              /* Session ID, used for windowing.  */
73   struct timeval ut_tv;         /* Time entry was made.  */
74   int32_t ut_addr;              /* Internet address of remote host.  */
75   char pad[32];                 /* Reserved for future use.  */
76 };
77
78 #define ut_time ut_tv.tv_sec    /* Backwards compatibility.  */
79
80 /* Tell the user that we have a modern system with UT_TYPE, UT_ID
81    and UT_TV fields.  */
82 #define _HAVE_UT_TYPE   1
83 #define _HAVE_UT_ID     1
84 #define _HAVE_UT_TV     1
85
86 __END_DECLS
87
88 #endif /* !_UTMP_H_ */