Documentation
¶
Index ¶
Constants ¶
View Source
const ( C_UT_LINESIZE = 32 C_UT_NAMESIZE = 32 C_UT_HOSTSIZE = 256 C_utmp_size = 384 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C_exit_status ¶
type C_utmp ¶
type C_utmp struct {
/* Type of record */
// C_ut_type C_short
// TODO 文档描述中是short,实际上 好像是int32
C_ut_type uint32 // C_int32_t
/* PID of login process */
C_ut_pid uint32
/* Device name of tty - "/dev/" */
C_ut_line [C_UT_LINESIZE]byte
/* Terminal name suffix, or inittab(5) ID */
C_ut_id [4]byte
/* Username */
C_ut_user [C_UT_NAMESIZE]byte
/* Hostname for remote login, or kernel version for run-level messages */
C_ut_host [C_UT_HOSTSIZE]byte
/* Exit status of a process marked as DEAD_PROCESS; not used by Linux init (1 */
C_ut_exit C_exit_status
/* Session ID (getsid(2)),used for windowing */
C_ut_session uint32
/* Time entry was made */
C_ut_tv C_timeval
/* Internet address of remote host; IPv4 address uses just ut_addr_v6[0] */
C_ut_addr_v6 [4]uint32
/* Reserved for future use */
C__unused [20]byte
}
func (C_utmp) MarshalBinary ¶
func (*C_utmp) UnmarshalBinary ¶
type C_utmpList ¶
type C_utmpList []C_utmp
func (*C_utmpList) UnmarshalBinary ¶
func (cus *C_utmpList) UnmarshalBinary(data []byte) error
type Exit_status ¶
type RecordTypeConst ¶
type RecordTypeConst int32
const ( /* Record does not contain valid info (formerly known as UT_UNKNOWN on Linux) */ EMPTY RecordTypeConst = iota /* Change in system run-level (see init(8)) */ RUN_LVL /* Time of system boot (in ut_tv) */ BOOT_TIME /* Time after system clock change (in ut_tv) */ NEW_TIME /* Time before system clock change (in ut_tv) */ OLD_TIME /* Process spawned by init(8) */ INIT_PROCESS /* Session leader process for user login */ LOGIN_PROCESS /* Normal process */ USER_PROCESS /* Terminated process */ DEAD_PROCESS /* Not implemented */ ACCOUNTING )
type Utmp ¶
type Utmp struct {
// 记录类型
RecordType RecordTypeConst
// 进程id
Pid int32
// 32个字节类型, 设备名称
DeviceName string
// 4个字节
TerminalId string
// 32个字节
UserName string
// 256个字节
HostName string
// 进程退出状态
ExitStatus Exit_status
SessionId int32
Timeval time.Time
RemoteIP net.IP
// contains filtered or unexported fields
}
解析原始数据类型,并转为 可读易识别的对象
Click to show internal directories.
Click to hide internal directories.