mirror of
https://github.com/golang/sys.git
synced 2026-02-08 03:36:03 +03:00
unix: change darwin Eproc/ExternProc members from int8 array to byte array
CL 328169 added Eproc and ExternProc types on darwin which have some int8 array members containing human-readable strings. In order to make it easier to convert these to Go strings, change them to byte arrays. Change-Id: I200494fd90d8506bce0f52a039ea59703981c8d3 Reviewed-on: https://go-review.googlesource.com/c/sys/+/359674 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
6e7872819d
commit
565ff80d9b
@@ -63,6 +63,11 @@ func main() {
|
||||
// the process creation time.
|
||||
externProcStarttimeRegex := regexp.MustCompile(`P_un\s*\[\d+\]byte`)
|
||||
b = externProcStarttimeRegex.ReplaceAll(b, []byte("P_starttime Timeval"))
|
||||
|
||||
// Convert [n]int8 to [n]byte in Eproc and ExternProc members to
|
||||
// simplify conversion to string.
|
||||
convertEprocRegex := regexp.MustCompile(`(P_comm|Wmesg|Login)(\s+)\[(\d+)\]int8`)
|
||||
b = convertEprocRegex.ReplaceAll(b, []byte("$1$2[$3]byte"))
|
||||
}
|
||||
|
||||
// Intentionally export __val fields in Fsid and Sigset_t
|
||||
|
||||
@@ -641,13 +641,13 @@ type Eproc struct {
|
||||
Tdev int32
|
||||
Tpgid int32
|
||||
Tsess uintptr
|
||||
Wmesg [8]int8
|
||||
Wmesg [8]byte
|
||||
Xsize int32
|
||||
Xrssize int16
|
||||
Xccount int16
|
||||
Xswrss int16
|
||||
Flag int32
|
||||
Login [12]int8
|
||||
Login [12]byte
|
||||
Spare [4]int32
|
||||
_ [4]byte
|
||||
}
|
||||
@@ -688,7 +688,7 @@ type ExternProc struct {
|
||||
P_priority uint8
|
||||
P_usrpri uint8
|
||||
P_nice int8
|
||||
P_comm [17]int8
|
||||
P_comm [17]byte
|
||||
P_pgrp uintptr
|
||||
P_addr uintptr
|
||||
P_xstat uint16
|
||||
|
||||
@@ -641,13 +641,13 @@ type Eproc struct {
|
||||
Tdev int32
|
||||
Tpgid int32
|
||||
Tsess uintptr
|
||||
Wmesg [8]int8
|
||||
Wmesg [8]byte
|
||||
Xsize int32
|
||||
Xrssize int16
|
||||
Xccount int16
|
||||
Xswrss int16
|
||||
Flag int32
|
||||
Login [12]int8
|
||||
Login [12]byte
|
||||
Spare [4]int32
|
||||
_ [4]byte
|
||||
}
|
||||
@@ -688,7 +688,7 @@ type ExternProc struct {
|
||||
P_priority uint8
|
||||
P_usrpri uint8
|
||||
P_nice int8
|
||||
P_comm [17]int8
|
||||
P_comm [17]byte
|
||||
P_pgrp uintptr
|
||||
P_addr uintptr
|
||||
P_xstat uint16
|
||||
|
||||
Reference in New Issue
Block a user