Back to index

glibc  2.9
utmpx.h
Go to the documentation of this file.
00001 /* Structures and definitions for the user accounting database.  GNU version.
00002    Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _UTMPX_H
00021 # error "Never include <bits/utmpx.h> directly; use <utmpx.h> instead."
00022 #endif
00023 
00024 #include <bits/types.h>
00025 #include <sys/time.h>
00026 #include <bits/wordsize.h>
00027 
00028 
00029 #ifdef __USE_GNU
00030 # include <paths.h>
00031 # define _PATH_UTMPX _PATH_UTMP
00032 # define _PATH_WTMPX _PATH_WTMP
00033 #endif
00034 
00035 
00036 #define __UT_LINESIZE       32
00037 #define __UT_NAMESIZE       32
00038 #define __UT_HOSTSIZE       256
00039 
00040 
00041 /* The structure describing the status of a terminated process.  This
00042    type is used in `struct utmpx' below.  */
00043 struct __exit_status
00044   {
00045 #ifdef __USE_GNU
00046     short int e_termination;       /* Process termination status.  */
00047     short int e_exit;              /* Process exit status.  */
00048 #else
00049     short int __e_termination;     /* Process termination status.  */
00050     short int __e_exit;            /* Process exit status.  */
00051 #endif
00052   };
00053 
00054 
00055 /* The structure describing an entry in the user accounting database.  */
00056 struct utmpx
00057 {
00058   short int ut_type;        /* Type of login.  */
00059   __pid_t ut_pid;           /* Process ID of login process.  */
00060   char ut_line[__UT_LINESIZE];     /* Devicename.  */
00061   char ut_id[4];            /* Inittab ID. */
00062   char ut_user[__UT_NAMESIZE];     /* Username.  */
00063   char ut_host[__UT_HOSTSIZE];     /* Hostname for remote login.  */
00064   struct __exit_status ut_exit;    /* Exit status of a process marked
00065                                as DEAD_PROCESS.  */
00066 
00067 /* The fields ut_session and ut_tv must be the same size when compiled
00068    32- and 64-bit.  This allows files and shared memory to be shared
00069    between 32- and 64-bit applications.  */
00070 #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
00071   __int32_t ut_session;            /* Session ID, used for windowing.  */
00072   struct
00073   {
00074     __int32_t tv_sec;              /* Seconds.  */
00075     __int32_t tv_usec;             /* Microseconds.  */
00076   } ut_tv;                  /* Time entry was made.  */
00077 #else
00078   long int ut_session;             /* Session ID, used for windowing.  */
00079   struct timeval ut_tv;            /* Time entry was made.  */
00080 #endif
00081   __int32_t ut_addr_v6[4];  /* Internet address of remote host.  */
00082   char __unused[20];        /* Reserved for future use.  */
00083 };
00084 
00085 
00086 /* Values for the `ut_type' field of a `struct utmpx'.  */
00087 #define EMPTY        0      /* No valid user accounting information.  */
00088 
00089 #ifdef __USE_GNU
00090 # define RUN_LVL     1      /* The system's runlevel.  */
00091 #endif
00092 #define BOOT_TIME    2      /* Time of system boot.  */
00093 #define NEW_TIME     3      /* Time after system clock changed.  */
00094 #define OLD_TIME     4      /* Time when system clock changed.  */
00095 
00096 #define INIT_PROCESS 5      /* Process spawned by the init process.  */
00097 #define LOGIN_PROCESS       6      /* Session leader of a logged in user.  */
00098 #define USER_PROCESS 7      /* Normal process.  */
00099 #define DEAD_PROCESS 8      /* Terminated process.  */
00100 
00101 #ifdef __USE_GNU
00102 # define ACCOUNTING  9      /* System accounting.  */
00103 #endif