aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/types_linux.go
diff options
context:
space:
mode:
authorMichael Munday <munday@ca.ibm.com>2016-03-30 23:56:49 -0400
committerBrad Fitzpatrick <bradfitz@golang.org>2016-04-03 22:12:35 +0000
commitaf74dca49732d5953331d14dc06ec635838c357c (patch)
tree6f3e305d431679b6a1f336bd44fe54aebdbeaa27 /src/syscall/types_linux.go
parentfe5be5aced063a16c5c36051045f8f8af313bed9 (diff)
downloadgo-af74dca49732d5953331d14dc06ec635838c357c.tar.xz
syscall: add support for s390x
On s390x char is unsigned. We cannot force it to be signed using -fsigned-char (see arm64) because the s390x gccgo API is already public and we need to stick as closely as possible to it to avoid breaking existing projects. In order to match the gccgo API we also force the RawSockaddr.Data and RawSockaddrUnix.Path fields to be signed. This CL adds a post-processing pass (mkpost.go) to mkall.sh in order to export the types of fields in PtraceRegs on s390x without affecting the API on other platforms. The types of these fields match their counterparts in gccgo. mkpost.go also cleans up the Pad_cgo* fields and X_* fields (these fields are not exported by gccgo currently). It could be extended to add build tags on platforms that need them. Change-Id: I66bdf5b86ec98af70baf666989027bb354df9e3e Reviewed-on: https://go-review.googlesource.com/20961 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/syscall/types_linux.go')
-rw-r--r--src/syscall/types_linux.go23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/syscall/types_linux.go b/src/syscall/types_linux.go
index cff4069370..9bccfcabd8 100644
--- a/src/syscall/types_linux.go
+++ b/src/syscall/types_linux.go
@@ -77,8 +77,8 @@ struct sockaddr_any {
// copied from /usr/include/linux/un.h
struct my_sockaddr_un {
sa_family_t sun_family;
-#if defined(__ARM_EABI__) || defined(__powerpc64__)
- // on ARM and PPC char is by default unsigned
+#if defined(__ARM_EABI__) || defined(__powerpc64__) || defined(__s390x__)
+ // on ARM, PPC and s390x char is by default unsigned
signed char sun_path[108];
#else
char sun_path[108];
@@ -93,10 +93,22 @@ typedef struct user_pt_regs PtraceRegs;
typedef struct pt_regs PtraceRegs;
#elif defined(__mips__)
typedef struct user PtraceRegs;
+#elif defined(__s390x__)
+typedef struct _user_regs_struct PtraceRegs;
#else
typedef struct user_regs_struct PtraceRegs;
#endif
+#if defined(__s390x__)
+typedef struct _user_psw_struct ptracePsw;
+typedef struct _user_fpregs_struct ptraceFpregs;
+typedef struct _user_per_struct ptracePer;
+#else
+typedef struct {} ptracePsw;
+typedef struct {} ptraceFpregs;
+typedef struct {} ptracePer;
+#endif
+
// The real epoll_event is a union, and godefs doesn't handle it well.
struct my_epoll_event {
uint32_t events;
@@ -367,6 +379,13 @@ const SizeofInotifyEvent = C.sizeof_struct_inotify_event
// Register structures
type PtraceRegs C.PtraceRegs
+// Structures contained in PtraceRegs on s390x (exported by post.go)
+type ptracePsw C.ptracePsw
+
+type ptraceFpregs C.ptraceFpregs
+
+type ptracePer C.ptracePer
+
// Misc
type FdSet C.fd_set