Blame bits/utmp.h

Packit Bot 95f862
/* The `struct utmp' type, describing entries in the utmp file.
Packit Bot 95f862
   Copyright (C) 1993-2019 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 Bot 95f862
#include <sys/time.h>
Packit Bot 95f862
#include <sys/types.h>
Packit Bot 95f862
#include <bits/wordsize.h>
Packit 6c4009
Packit 6c4009
Packit Bot 95f862
#define UT_LINESIZE	32
Packit Bot 95f862
#define UT_NAMESIZE	32
Packit Bot 95f862
#define UT_HOSTSIZE	256
Packit 6c4009
Packit 6c4009
Packit Bot 95f862
/* The structure describing an entry in the database of
Packit Bot 95f862
   previous logins.  */
Packit 6c4009
struct lastlog
Packit 6c4009
  {
Packit Bot 95f862
#if __WORDSIZE_TIME64_COMPAT32
Packit Bot 95f862
    int32_t ll_time;
Packit Bot 95f862
#else
Packit Bot 95f862
    __time_t ll_time;
Packit Bot 95f862
#endif
Packit 6c4009
    char ll_line[UT_LINESIZE];
Packit 6c4009
    char ll_host[UT_HOSTSIZE];
Packit 6c4009
  };
Packit 6c4009
Packit Bot 95f862
Packit Bot 95f862
/* The structure describing the status of a terminated process.  This
Packit Bot 95f862
   type is used in `struct utmp' below.  */
Packit Bot 95f862
struct exit_status
Packit Service 6a56c3
  {
Packit Bot 95f862
    short int e_termination;	/* Process termination status.  */
Packit Bot 95f862
    short int e_exit;		/* Process exit status.  */
Packit Bot 0c2104
  };
Packit Service 6a56c3
Packit Service 6a56c3
Packit Bot 95f862
/* The structure describing an entry in the user accounting database.  */
Packit Bot 95f862
struct utmp
Packit Bot 95f862
{
Packit Bot 95f862
  short int ut_type;		/* Type of login.  */
Packit Bot 95f862
  pid_t ut_pid;			/* Process ID of login process.  */
Packit Bot 95f862
  char ut_line[UT_LINESIZE]
Packit Bot 95f862
    __attribute_nonstring__;	/* Devicename.  */
Packit Bot fbd33d
  char ut_id[4]
Packit Bot fbd33d
    __attribute_nonstring__;	/* Inittab ID.  */
Packit Bot 95f862
  char ut_user[UT_NAMESIZE]
Packit Bot 95f862
    __attribute_nonstring__;	/* Username.  */
Packit Bot 95f862
  char ut_host[UT_HOSTSIZE]
Packit Bot 95f862
    __attribute_nonstring__;	/* Hostname for remote login.  */
Packit Bot 95f862
  struct exit_status ut_exit;	/* Exit status of a process marked
Packit Bot 95f862
				   as DEAD_PROCESS.  */
Packit Bot 95f862
/* The ut_session and ut_tv fields must be the same size when compiled
Packit Bot 95f862
   32- and 64-bit.  This allows data files and shared memory to be
Packit Bot 95f862
   shared between 32- and 64-bit applications.  */
Packit Bot 95f862
#if __WORDSIZE_TIME64_COMPAT32
Packit Bot 95f862
  int32_t ut_session;		/* Session ID, used for windowing.  */
Packit Bot 95f862
  struct
Packit Bot 95f862
  {
Packit Bot 95f862
    int32_t tv_sec;		/* Seconds.  */
Packit Bot 95f862
    int32_t tv_usec;		/* Microseconds.  */
Packit Bot 95f862
  } ut_tv;			/* Time entry was made.  */
Packit Bot 95f862
#else
Packit Bot 95f862
  long int ut_session;		/* Session ID, used for windowing.  */
Packit Bot 95f862
  struct timeval ut_tv;		/* Time entry was made.  */
Packit Bot 95f862
#endif
Packit Bot 95f862
Packit Bot 95f862
  int32_t ut_addr_v6[4];	/* Internet address of remote host.  */
Packit Bot 95f862
  char __glibc_reserved[20];		/* Reserved for future use.  */
Packit Bot 95f862
};
Packit Bot 95f862
Packit Bot 95f862
/* Backwards compatibility hacks.  */
Packit Bot 95f862
#define ut_name		ut_user
Packit Bot 95f862
#ifndef _NO_UT_TIME
Packit Bot 95f862
/* We have a problem here: `ut_time' is also used otherwise.  Define
Packit Bot 95f862
   _NO_UT_TIME if the compiler complains.  */
Packit Bot 95f862
# define ut_time	ut_tv.tv_sec
Packit Bot 95f862
#endif
Packit Bot 95f862
#define ut_xtime	ut_tv.tv_sec
Packit Bot 95f862
#define ut_addr		ut_addr_v6[0]
Packit Bot 95f862
Packit Bot 95f862
Packit Bot 95f862
/* Values for the `ut_type' field of a `struct utmp'.  */
Packit Bot 95f862
#define EMPTY		0	/* No valid user accounting information.  */
Packit Bot 95f862
Packit Bot 95f862
#define RUN_LVL		1	/* The system's runlevel.  */
Packit Bot 95f862
#define BOOT_TIME	2	/* Time of system boot.  */
Packit Bot 95f862
#define NEW_TIME	3	/* Time after system clock changed.  */
Packit Bot 95f862
#define OLD_TIME	4	/* Time when system clock changed.  */
Packit Bot 95f862
Packit Bot 95f862
#define INIT_PROCESS	5	/* Process spawned by the init process.  */
Packit Bot 95f862
#define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
Packit Bot 95f862
#define USER_PROCESS	7	/* Normal process.  */
Packit Bot 95f862
#define DEAD_PROCESS	8	/* Terminated process.  */
Packit Bot 95f862
Packit Bot 95f862
#define ACCOUNTING	9
Packit Bot 95f862
Packit Bot 95f862
/* Old Linux name for the EMPTY type.  */
Packit Bot 95f862
#define UT_UNKNOWN	EMPTY
Packit Bot 95f862
Packit Bot 95f862
Packit Bot 95f862
/* Tell the user that we have a modern system with UT_HOST, UT_PID,
Packit Bot 95f862
   UT_TYPE, UT_ID and UT_TV fields.  */
Packit Bot 95f862
#define _HAVE_UT_TYPE	1
Packit Bot 95f862
#define _HAVE_UT_PID	1
Packit Bot 95f862
#define _HAVE_UT_ID	1
Packit Bot 95f862
#define _HAVE_UT_TV	1
Packit Bot 95f862
#define _HAVE_UT_HOST	1