cpp-d1064d
[cross.git] / i686-linux-gnu-4.7 / usr / include / x86_64-linux-gnu / bits / utmp.h
1 /* The `struct utmp' type, describing entries in the utmp file.  GNU version.
2    Copyright (C) 1993-2018 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4
5    The GNU C Library is free software; you can redistribute it and/or
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.
9
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
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18
19 #ifndef _UTMP_H
20 # error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
21 #endif
22
23 #include <paths.h>
24 #include <sys/time.h>
25 #include <sys/types.h>
26 #include <bits/wordsize.h>
27
28
29 #define UT_LINESIZE     32
30 #define UT_NAMESIZE     32
31 #define UT_HOSTSIZE     256
32
33
34 /* The structure describing an entry in the database of
35    previous logins.  */
36 struct lastlog
37   {
38 #if __WORDSIZE_TIME64_COMPAT32
39     int32_t ll_time;
40 #else
41     __time_t ll_time;
42 #endif
43     char ll_line[UT_LINESIZE];
44     char ll_host[UT_HOSTSIZE];
45   };
46
47
48 /* The structure describing the status of a terminated process.  This
49    type is used in `struct utmp' below.  */
50 struct exit_status
51   {
52     short int e_termination;    /* Process termination status.  */
53     short int e_exit;           /* Process exit status.  */
54   };
55
56
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.  */
64   char ut_id[4];                /* Inittab ID.  */
65   char ut_user[UT_NAMESIZE]
66     __attribute_nonstring__;    /* Username.  */
67   char ut_host[UT_HOSTSIZE]
68     __attribute_nonstring__;    /* Hostname for remote login.  */
69   struct exit_status ut_exit;   /* Exit status of a process marked
70                                    as DEAD_PROCESS.  */
71 /* The ut_session and ut_tv fields must be the same size when compiled
72    32- and 64-bit.  This allows data files and shared memory to be
73    shared between 32- and 64-bit applications.  */
74 #if __WORDSIZE_TIME64_COMPAT32
75   int32_t ut_session;           /* Session ID, used for windowing.  */
76   struct
77   {
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
85
86   int32_t ut_addr_v6[4];        /* Internet address of remote host.  */
87   char __glibc_reserved[20];            /* Reserved for future use.  */
88 };
89
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]
99
100
101 /* Values for the `ut_type' field of a `struct utmp'.  */
102 #define EMPTY           0       /* No valid user accounting information.  */
103
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.  */
108
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.  */
113
114 #define ACCOUNTING      9
115
116 /* Old Linux name for the EMPTY type.  */
117 #define UT_UNKNOWN      EMPTY
118
119
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