June 2025 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 1 | 2 | 3 | 4 | 5 | 6 |
001: /* The `struct utmp' type, describing entries in the utmp file. GNU version. 002: Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002 003: Free Software Foundation, Inc. 004: This file is part of the GNU C Library. 005: 006: The GNU C Library is free software; you can redistribute it and/or 007: modify it under the terms of the GNU Lesser General Public 008: License as published by the Free Software Foundation; either 009: version 2.1 of the License, or (at your option) any later version. 010: 011: The GNU C Library is distributed in the hope that it will be useful, 012: but WITHOUT ANY WARRANTY; without even the implied warranty of 013: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014: Lesser General Public License for more details. 015: 016: You should have received a copy of the GNU Lesser General Public 017: License along with the GNU C Library; if not, write to the Free 018: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 019: 02111-1307 USA. */ 020: 021: #ifndef _UTMP_H 022: # error "Never include <bits/utmp.h> directly; use <utmp.h> instead." 023: #endif 024: 025: #include <paths.h> 026: #include <sys/time.h> 027: #include <sys/types.h> 028: #include <bits/wordsize.h> 029: 030: 031: #define UT_LINESIZE 32 032: #define UT_NAMESIZE 32 033: #define UT_HOSTSIZE 256 034: 035: 036: /* The structure describing an entry in the database of 037: previous logins. */ 038: struct lastlog 039: { 040: #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 041: int32_t ll_time; 042: #else 043: __time_t ll_time; 044: #endif 045: char ll_line[UT_LINESIZE]; 046: char ll_host[UT_HOSTSIZE]; 047: }; 048: 049: 050: /* The structure describing the status of a terminated process. This 051: type is used in `struct utmp' below. */ 052: struct exit_status 053: { 054: short int e_termination; /* Process termination status. */ 055: short int e_exit; /* Process exit status. */ 056: }; 057: 058: 059: /* The structure describing an entry in the user accounting database. */ 060: struct utmp 061: { 062: short int ut_type; /* Type of login. */ 063: pid_t ut_pid; /* Process ID of login process. */ 064: char ut_line[UT_LINESIZE]; /* Devicename. */ 065: char ut_id[4]; /* Inittab ID. */ 066: char ut_user[UT_NAMESIZE]; /* Username. */ 067: char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */ 068: struct exit_status ut_exit; /* Exit status of a process marked 069: as DEAD_PROCESS. */ 070: /* The ut_session and ut_tv fields must be the same size when compiled 071: 32- and 64-bit. This allows data files and shared memory to be 072: shared between 32- and 64-bit applications. */ 073: #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 074: int32_t ut_session; /* Session ID, used for windowing. */ 075: struct 076: { 077: int32_t tv_sec; /* Seconds. */ 078: int32_t tv_usec; /* Microseconds. */ 079: } ut_tv; /* Time entry was made. */ 080: #else 081: long int ut_session; /* Session ID, used for windowing. */ 082: struct timeval ut_tv; /* Time entry was made. */ 083: #endif 084: 085: int32_t ut_addr_v6[4]; /* Internet address of remote host. */ 086: char __unused[20]; /* Reserved for future use. */ 087: }; 088: 089: /* Backwards compatibility hacks. */ 090: #define ut_name ut_user 091: #ifndef _NO_UT_TIME 092: /* We have a problem here: `ut_time' is also used otherwise. Define 093: _NO_UT_TIME if the compiler complains. */ 094: # define ut_time ut_tv.tv_sec 095: #endif 096: #define ut_xtime ut_tv.tv_sec 097: #define ut_addr ut_addr_v6[0] 098: 099: 100: /* Values for the `ut_type' field of a `struct utmp'. */ 101: #define EMPTY 0 /* No valid user accounting information. */ 102: 103: #define RUN_LVL 1 /* The system's runlevel. */ 104: #define BOOT_TIME 2 /* Time of system boot. */ 105: #define NEW_TIME 3 /* Time after system clock changed. */ 106: #define OLD_TIME 4 /* Time when system clock changed. */ 107: 108: #define INIT_PROCESS 5 /* Process spawned by the init process. */ 109: #define LOGIN_PROCESS 6 /* Session leader of a logged in user. */ 110: #define USER_PROCESS 7 /* Normal process. */ 111: #define DEAD_PROCESS 8 /* Terminated process. */ 112: 113: #define ACCOUNTING 9 114: 115: /* Old Linux name for the EMPTY type. */ 116: #define UT_UNKNOWN EMPTY 117: 118: 119: /* Tell the user that we have a modern system with UT_HOST, UT_PID, 120: UT_TYPE, UT_ID and UT_TV fields. */ 121: #define _HAVE_UT_TYPE 1 122: #define _HAVE_UT_PID 1 123: #define _HAVE_UT_ID 1 124: #define _HAVE_UT_TV 1 125: #define _HAVE_UT_HOST 1 126: