1*53ee8cc1Swenshuai.xi /* Structures and definitions for the user accounting database. GNU version. 2*53ee8cc1Swenshuai.xi Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. 3*53ee8cc1Swenshuai.xi This file is part of the GNU C Library. 4*53ee8cc1Swenshuai.xi 5*53ee8cc1Swenshuai.xi The GNU C Library is free software; you can redistribute it and/or 6*53ee8cc1Swenshuai.xi modify it under the terms of the GNU Lesser General Public 7*53ee8cc1Swenshuai.xi License as published by the Free Software Foundation; either 8*53ee8cc1Swenshuai.xi version 2.1 of the License, or (at your option) any later version. 9*53ee8cc1Swenshuai.xi 10*53ee8cc1Swenshuai.xi The GNU C Library is distributed in the hope that it will be useful, 11*53ee8cc1Swenshuai.xi but WITHOUT ANY WARRANTY; without even the implied warranty of 12*53ee8cc1Swenshuai.xi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13*53ee8cc1Swenshuai.xi Lesser General Public License for more details. 14*53ee8cc1Swenshuai.xi 15*53ee8cc1Swenshuai.xi You should have received a copy of the GNU Lesser General Public 16*53ee8cc1Swenshuai.xi License along with the GNU C Library; if not, write to the Free 17*53ee8cc1Swenshuai.xi Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18*53ee8cc1Swenshuai.xi 02111-1307 USA. */ 19*53ee8cc1Swenshuai.xi 20*53ee8cc1Swenshuai.xi #ifndef _UTMPX_H 21*53ee8cc1Swenshuai.xi # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead." 22*53ee8cc1Swenshuai.xi #endif 23*53ee8cc1Swenshuai.xi 24*53ee8cc1Swenshuai.xi #include <bits/types.h> 25*53ee8cc1Swenshuai.xi #include <sys/time.h> 26*53ee8cc1Swenshuai.xi #include <bits/wordsize.h> 27*53ee8cc1Swenshuai.xi 28*53ee8cc1Swenshuai.xi 29*53ee8cc1Swenshuai.xi #ifdef __USE_GNU 30*53ee8cc1Swenshuai.xi # include <paths.h> 31*53ee8cc1Swenshuai.xi # define _PATH_UTMPX _PATH_UTMP 32*53ee8cc1Swenshuai.xi # define _PATH_WTMPX _PATH_WTMP 33*53ee8cc1Swenshuai.xi #endif 34*53ee8cc1Swenshuai.xi 35*53ee8cc1Swenshuai.xi 36*53ee8cc1Swenshuai.xi #define __UT_LINESIZE 32 37*53ee8cc1Swenshuai.xi #define __UT_NAMESIZE 32 38*53ee8cc1Swenshuai.xi #define __UT_HOSTSIZE 256 39*53ee8cc1Swenshuai.xi 40*53ee8cc1Swenshuai.xi 41*53ee8cc1Swenshuai.xi /* The structure describing the status of a terminated process. This 42*53ee8cc1Swenshuai.xi type is used in `struct utmpx' below. */ 43*53ee8cc1Swenshuai.xi struct __exit_status 44*53ee8cc1Swenshuai.xi { 45*53ee8cc1Swenshuai.xi #ifdef __USE_GNU 46*53ee8cc1Swenshuai.xi short int e_termination; /* Process termination status. */ 47*53ee8cc1Swenshuai.xi short int e_exit; /* Process exit status. */ 48*53ee8cc1Swenshuai.xi #else 49*53ee8cc1Swenshuai.xi short int __e_termination; /* Process termination status. */ 50*53ee8cc1Swenshuai.xi short int __e_exit; /* Process exit status. */ 51*53ee8cc1Swenshuai.xi #endif 52*53ee8cc1Swenshuai.xi }; 53*53ee8cc1Swenshuai.xi 54*53ee8cc1Swenshuai.xi 55*53ee8cc1Swenshuai.xi /* The structure describing an entry in the user accounting database. */ 56*53ee8cc1Swenshuai.xi struct utmpx 57*53ee8cc1Swenshuai.xi { 58*53ee8cc1Swenshuai.xi short int ut_type; /* Type of login. */ 59*53ee8cc1Swenshuai.xi __pid_t ut_pid; /* Process ID of login process. */ 60*53ee8cc1Swenshuai.xi char ut_line[__UT_LINESIZE]; /* Devicename. */ 61*53ee8cc1Swenshuai.xi char ut_id[4]; /* Inittab ID. */ 62*53ee8cc1Swenshuai.xi char ut_user[__UT_NAMESIZE]; /* Username. */ 63*53ee8cc1Swenshuai.xi char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */ 64*53ee8cc1Swenshuai.xi struct __exit_status ut_exit; /* Exit status of a process marked 65*53ee8cc1Swenshuai.xi as DEAD_PROCESS. */ 66*53ee8cc1Swenshuai.xi 67*53ee8cc1Swenshuai.xi /* The fields ut_session and ut_tv must be the same size when compiled 68*53ee8cc1Swenshuai.xi 32- and 64-bit. This allows files and shared memory to be shared 69*53ee8cc1Swenshuai.xi between 32- and 64-bit applications. */ 70*53ee8cc1Swenshuai.xi #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 71*53ee8cc1Swenshuai.xi __int32_t ut_session; /* Session ID, used for windowing. */ 72*53ee8cc1Swenshuai.xi struct 73*53ee8cc1Swenshuai.xi { 74*53ee8cc1Swenshuai.xi __int32_t tv_sec; /* Seconds. */ 75*53ee8cc1Swenshuai.xi __int32_t tv_usec; /* Microseconds. */ 76*53ee8cc1Swenshuai.xi } ut_tv; /* Time entry was made. */ 77*53ee8cc1Swenshuai.xi #else 78*53ee8cc1Swenshuai.xi long int ut_session; /* Session ID, used for windowing. */ 79*53ee8cc1Swenshuai.xi struct timeval ut_tv; /* Time entry was made. */ 80*53ee8cc1Swenshuai.xi #endif 81*53ee8cc1Swenshuai.xi __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ 82*53ee8cc1Swenshuai.xi char __unused[20]; /* Reserved for future use. */ 83*53ee8cc1Swenshuai.xi }; 84*53ee8cc1Swenshuai.xi 85*53ee8cc1Swenshuai.xi 86*53ee8cc1Swenshuai.xi /* Values for the `ut_type' field of a `struct utmpx'. */ 87*53ee8cc1Swenshuai.xi #define EMPTY 0 /* No valid user accounting information. */ 88*53ee8cc1Swenshuai.xi 89*53ee8cc1Swenshuai.xi #ifdef __USE_GNU 90*53ee8cc1Swenshuai.xi # define RUN_LVL 1 /* The system's runlevel. */ 91*53ee8cc1Swenshuai.xi #endif 92*53ee8cc1Swenshuai.xi #define BOOT_TIME 2 /* Time of system boot. */ 93*53ee8cc1Swenshuai.xi #define NEW_TIME 3 /* Time after system clock changed. */ 94*53ee8cc1Swenshuai.xi #define OLD_TIME 4 /* Time when system clock changed. */ 95*53ee8cc1Swenshuai.xi 96*53ee8cc1Swenshuai.xi #define INIT_PROCESS 5 /* Process spawned by the init process. */ 97*53ee8cc1Swenshuai.xi #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ 98*53ee8cc1Swenshuai.xi #define USER_PROCESS 7 /* Normal process. */ 99*53ee8cc1Swenshuai.xi #define DEAD_PROCESS 8 /* Terminated process. */ 100*53ee8cc1Swenshuai.xi 101*53ee8cc1Swenshuai.xi #ifdef __USE_GNU 102*53ee8cc1Swenshuai.xi # define ACCOUNTING 9 /* System accounting. */ 103*53ee8cc1Swenshuai.xi #endif 104