|
Packit |
6c4009 |
/* The `struct utmp' type, describing entries in the utmp file. GNU version.
|
|
Packit |
6c4009 |
Copyright (C) 1993-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _UTMP_H
|
|
Packit |
6c4009 |
# error "Never include <bits/utmp.h> directly; use <utmp.h> instead."
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <paths.h>
|
|
Packit |
6c4009 |
#include <sys/time.h>
|
|
Packit |
6c4009 |
#include <sys/types.h>
|
|
Packit |
6c4009 |
#include <bits/wordsize.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define UT_LINESIZE 32
|
|
Packit |
6c4009 |
#define UT_NAMESIZE 32
|
|
Packit |
6c4009 |
#define UT_HOSTSIZE 256
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The structure describing an entry in the database of
|
|
Packit |
6c4009 |
previous logins. */
|
|
Packit |
6c4009 |
struct lastlog
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
#if __WORDSIZE == 32
|
|
Packit |
6c4009 |
int64_t ll_time;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
__time_t ll_time;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
char ll_line[UT_LINESIZE];
|
|
Packit |
6c4009 |
char ll_host[UT_HOSTSIZE];
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The structure describing the status of a terminated process. This
|
|
Packit |
6c4009 |
type is used in `struct utmp' below. */
|
|
Packit |
6c4009 |
struct exit_status
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
short int e_termination; /* Process termination status. */
|
|
Packit |
6c4009 |
short int e_exit; /* Process exit status. */
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The structure describing an entry in the user accounting database. */
|
|
Packit |
6c4009 |
struct utmp
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
short int ut_type; /* Type of login. */
|
|
Packit |
6c4009 |
pid_t ut_pid; /* Process ID of login process. */
|
|
Packit |
6c4009 |
char ut_line[UT_LINESIZE]
|
|
Packit |
6c4009 |
__attribute_nonstring__; /* Devicename. */
|
|
Packit Bot |
fbd33d |
char ut_id[4]
|
|
Packit Bot |
fbd33d |
__attribute_nonstring__; /* Inittab ID. */
|
|
Packit |
6c4009 |
char ut_user[UT_NAMESIZE]
|
|
Packit |
6c4009 |
__attribute_nonstring__; /* Username. */
|
|
Packit |
6c4009 |
char ut_host[UT_HOSTSIZE]
|
|
Packit |
6c4009 |
__attribute_nonstring__; /* Hostname for remote login. */
|
|
Packit |
6c4009 |
struct exit_status ut_exit; /* Exit status of a process marked
|
|
Packit |
6c4009 |
as DEAD_PROCESS. */
|
|
Packit |
6c4009 |
/* The ut_session and ut_tv fields must be the same size when compiled
|
|
Packit |
6c4009 |
32- and 64-bit. This allows data files and shared memory to be
|
|
Packit |
6c4009 |
shared between 32- and 64-bit applications. */
|
|
Packit |
6c4009 |
#if __WORDSIZE == 32
|
|
Packit |
6c4009 |
int64_t ut_session; /* Session ID, used for windowing. */
|
|
Packit |
6c4009 |
struct
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int64_t tv_sec; /* Seconds. */
|
|
Packit |
6c4009 |
int64_t tv_usec; /* Microseconds. */
|
|
Packit |
6c4009 |
} ut_tv; /* Time entry was made. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
long int ut_session; /* Session ID, used for windowing. */
|
|
Packit |
6c4009 |
struct timeval ut_tv; /* Time entry was made. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
int32_t ut_addr_v6[4]; /* Internet address of remote host. */
|
|
Packit |
6c4009 |
char __glibc_reserved[20]; /* Reserved for future use. */
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Backwards compatibility hacks. */
|
|
Packit |
6c4009 |
#define ut_name ut_user
|
|
Packit |
6c4009 |
#ifndef _NO_UT_TIME
|
|
Packit |
6c4009 |
/* We have a problem here: `ut_time' is also used otherwise. Define
|
|
Packit |
6c4009 |
_NO_UT_TIME if the compiler complains. */
|
|
Packit |
6c4009 |
# define ut_time ut_tv.tv_sec
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#define ut_xtime ut_tv.tv_sec
|
|
Packit |
6c4009 |
#define ut_addr ut_addr_v6[0]
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Values for the `ut_type' field of a `struct utmp'. */
|
|
Packit |
6c4009 |
#define EMPTY 0 /* No valid user accounting information. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define RUN_LVL 1 /* The system's runlevel. */
|
|
Packit |
6c4009 |
#define BOOT_TIME 2 /* Time of system boot. */
|
|
Packit |
6c4009 |
#define NEW_TIME 3 /* Time after system clock changed. */
|
|
Packit |
6c4009 |
#define OLD_TIME 4 /* Time when system clock changed. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define INIT_PROCESS 5 /* Process spawned by the init process. */
|
|
Packit |
6c4009 |
#define LOGIN_PROCESS 6 /* Session leader of a logged in user. */
|
|
Packit |
6c4009 |
#define USER_PROCESS 7 /* Normal process. */
|
|
Packit |
6c4009 |
#define DEAD_PROCESS 8 /* Terminated process. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define ACCOUNTING 9
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Old Linux name for the EMPTY type. */
|
|
Packit |
6c4009 |
#define UT_UNKNOWN EMPTY
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Tell the user that we have a modern system with UT_HOST, UT_PID,
|
|
Packit |
6c4009 |
UT_TYPE, UT_ID and UT_TV fields. */
|
|
Packit |
6c4009 |
#define _HAVE_UT_TYPE 1
|
|
Packit |
6c4009 |
#define _HAVE_UT_PID 1
|
|
Packit |
6c4009 |
#define _HAVE_UT_ID 1
|
|
Packit |
6c4009 |
#define _HAVE_UT_TV 1
|
|
Packit |
6c4009 |
#define _HAVE_UT_HOST 1
|