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:
Tobias Klauser
2021-10-30 16:03:51 +00:00
committed by Tobias Klauser
parent 6e7872819d
commit 565ff80d9b
3 changed files with 11 additions and 6 deletions
+5
View File
@@ -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