From d86a995563bc9d451d68334458075a3e6ad16c62 Mon Sep 17 00:00:00 2001 From: shirou Date: Sat, 2 Mar 2024 11:07:47 +0900 Subject: [PATCH 1/3] [host][linux]: fix utmp size on linux/arm64 --- host/host_linux_arm64.go | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/host/host_linux_arm64.go b/host/host_linux_arm64.go index eebef55..4ea13f7 100644 --- a/host/host_linux_arm64.go +++ b/host/host_linux_arm64.go @@ -1,4 +1,4 @@ -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs types_linux.go package host @@ -9,7 +9,7 @@ const ( sizeofInt = 0x4 sizeofLong = 0x8 sizeofLongLong = 0x8 - sizeOfUtmp = 0x180 + sizeOfUtmp = 0x190 ) type ( @@ -19,27 +19,27 @@ type ( _C_long_long int64 ) -type utmp struct { - 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 timeval - Addr_v6 [4]int32 - X__glibc_reserved [20]int8 -} - -type exit_status struct { - Termination int16 - Exit int16 -} - -type timeval struct { - Sec int64 - Usec int64 -} +type ( + utmp struct { + Type int16 + Pid int32 + Line [32]uint8 + Id [4]uint8 + User [32]uint8 + Host [256]uint8 + Exit exit_status + Session int64 + Tv timeval + Addr_v6 [4]int32 + X__glibc_reserved [20]uint8 + Pad_cgo_0 [4]byte + } + exit_status struct { + Termination int16 + Exit int16 + } + timeval struct { + Sec int64 + Usec int64 + } +) From cfb7a5dc2e452adec1bb2da7ddaaaaeb5e5d7baf Mon Sep 17 00:00:00 2001 From: shirou Date: Sat, 2 Mar 2024 11:20:49 +0900 Subject: [PATCH 2/3] [host][linux]: change Line/User/Host to int8 on utmp Generated code is uint8 on arm64. However, it is not same as other archtectures. This commit changes by hand. --- host/host_linux_arm64.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/host/host_linux_arm64.go b/host/host_linux_arm64.go index 4ea13f7..0f5cce6 100644 --- a/host/host_linux_arm64.go +++ b/host/host_linux_arm64.go @@ -23,10 +23,10 @@ type ( utmp struct { Type int16 Pid int32 - Line [32]uint8 - Id [4]uint8 - User [32]uint8 - Host [256]uint8 + Line [32]int8 // changed by hand #1603 + Id [4]int8 // changed by hand + User [32]int8 // changed by hand + Host [256]int8 // changed by hand Exit exit_status Session int64 Tv timeval From cbefbb023ef1be1cc410bf115b644bb4cdb4d9c8 Mon Sep 17 00:00:00 2001 From: shirou Date: Mon, 4 Mar 2024 22:25:21 +0900 Subject: [PATCH 3/3] [host][linux]: add pading on linux_arm64 --- host/host_linux_arm64.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/host/host_linux_arm64.go b/host/host_linux_arm64.go index 0f5cce6..cd0b4dd 100644 --- a/host/host_linux_arm64.go +++ b/host/host_linux_arm64.go @@ -22,8 +22,9 @@ type ( type ( utmp struct { Type int16 + Pad_cgo_0 [2]byte // changed by hand #1603 Pid int32 - Line [32]int8 // changed by hand #1603 + Line [32]int8 // changed by hand Id [4]int8 // changed by hand User [32]int8 // changed by hand Host [256]int8 // changed by hand @@ -32,7 +33,7 @@ type ( Tv timeval Addr_v6 [4]int32 X__glibc_reserved [20]uint8 - Pad_cgo_0 [4]byte + Pad_cgo_1 [4]byte } exit_status struct { Termination int16