From 3303647209557312e5db51450ea8bbdef56d5176 Mon Sep 17 00:00:00 2001 From: Shirou WAKAYAMA Date: Thu, 1 Oct 2015 17:21:37 +0900 Subject: [PATCH] host[linux]: fix utmp struct on arm. --- host/host_linux_arm.go | 53 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/host/host_linux_arm.go b/host/host_linux_arm.go index d4455ea..329e530 100644 --- a/host/host_linux_arm.go +++ b/host/host_linux_arm.go @@ -3,25 +3,40 @@ package host -type exitStatus struct { - Etermination int16 // Process termination status. - Eexit int16 // Process exit status. -} -type timeval struct { - TvSec uint32 // Seconds. - TvUsec uint32 // Microseconds. -} +const ( + sizeofPtr = 0x8 + sizeofShort = 0x2 + sizeofInt = 0x4 + sizeofLong = 0x8 + sizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) type utmp struct { - Type int16 // Type of login. - Pid int32 // Process ID of login process. - Line [32]byte // Devicename. - ID [4]byte // Inittab ID. - User [32]byte // Username. - Host [256]byte // Hostname for remote login. - Exit exitStatus // Exit status of a process marked - Session int32 // Session ID, used for windowing. - Tv timeval // Time entry was made. - AddrV6 [16]byte // Internet address of remote host. - Unused [20]byte // Reserved for future use. // original is 20 + Type int16 + Pad_cgo_0 [2]byte + Pid int32 + Line [32]int8 + Id [4]int8 + User [32]int8 + Host [256]int8 + Exit exit_status + Session int32 + Tv UtTv + Addr_v6 [4]int32 + X__glibc_reserved [20]int8 +} +type exit_status struct { + Termination int16 + Exit int16 +} +type UtTv struct { + TvSec int32 + TvUsec int32 }