fenxi

command
v0.0.0-...-63b2ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: GPL-2.0 Imports: 9 Imported by: 0

README

参阅 https://blog.csdn.net/oxford_d/article/details/51820031 https://blog.csdn.net/counsellor/article/details/87082207 可以通过命令查看文档

    man wtmp
/usr/include/bits/utmp.h



struct utmp
{
    short int ut_type; //登录类型
    pid_t ut_pid; //login 进程的pid
    char ut_line[UT_LINESIZE]; //登录装置名, 省略了"/dev/"   
     char ut_id[4]; //Inittab ID
    char ut_user[UT_NAMESIZE]; //登录账号
    char ut_host[UT_HOSTSIZE]; //登录账号的远程主机名称
    struxt exit_status ut_exit; //当类型为DEAD_PROCESS 时进程的结束状态
    long int ut_session; //Sessioc ID
    struct timeval ut_tv; //时间记录
    int32_t ut_addr_v6[4]; //远程主机的网络地址
    char __unused[20]; //保留未使用
};

ut_type 有以下几种类型:
EMPTY:此为空的记录.
RUN_LVL:记录系统run-level 的改变
BOOT_TIME:记录系统开机时间
NEW_TIME:记录系统时间改变后的时间
OLD_TINE:记录当改变系统时间时的时间.
INIT_PROCESS:记录一个由init 衍生出来的进程.
LOGIN_PROCESS:记录 login 进程.
USER_PROCESS:记录一般进程.
DEAD_PROCESS:记录一结束的进程.
ACCOUNTING:目前尚未使用.
exit_status 结构定义:
struct exit_status
{
    short int e_termination; //进程结束状态
    short int e_exit; //进程退出状态
};

struct timeval 结构定义:
struct timeval{
    time_t      tv_sec;     /* 秒数 */
    suseconds_t tv_usec;    /* 微秒 */
};

相关常数定义如下:
UT_LINESIZE 32
UT_NAMESIZE 32
UT_HOSTSIZE 256






            /* The ut_session and ut_tv fields must be the same size when
                  compiled 32- and 64-bit.  This allows data files and shared
                  memory to be shared between 32- and 64-bit applications. */
           #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
               int32_t ut_session;           /* Session ID (getsid(2)),
                                                used for windowing */
               struct {
                   int32_t tv_sec;           /* Seconds */
                   int32_t tv_usec;          /* Microseconds */
               } ut_tv;                      /* Time entry was made */
           #else
                long   ut_session;           /* Session ID */
                struct timeval ut_tv;        /* Time entry was made */
           #endif




Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL