Patchwork [libgo] Provide libc_ptrace on Solaris 2/SPARC

login
register
mail settings
Submitter Rainer Orth
Date Jan. 14, 2011, 4:20 p.m.
Message ID <yddbp3jpici.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/78951/
State New
Headers show

Comments

Rainer Orth - Jan. 14, 2011, 4:20 p.m.
libgo fails to build on Solaris 2/SPARC since libc_ptrace is missing.
The following patch provides it.  This is currently a duplicate of what
is in syscall_solaris_{386, amd64}.go, not sure what's the best way to
avoid this.

With this patch, libgo builds both 32 and 64-bit on Solaris 11/SPARC.

Ok for mainline?

	Rainer


2011-01-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libgo:
	* syscalls/syscall_solaris_sparc.go (libc_ptrace): Define.
	* syscalls/syscall_solaris_sparc64.go (libc_ptrace): Likewise.

Patch

diff -r 6c184227ca86 libgo/syscalls/syscall_solaris_sparc.go
--- a/libgo/syscalls/syscall_solaris_sparc.go	Fri Jan 14 10:25:46 2011 +0100
+++ b/libgo/syscalls/syscall_solaris_sparc.go	Fri Jan 14 17:19:25 2011 +0100
@@ -1,7 +1,17 @@ 
-// syscall_solaris_sparc.go -- Solaris SPARC specific support
+// syscall_solaris_sparc.go -- Solaris/SPARC specific support
 
 // Copyright 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
 package syscall
+
+import "unsafe"
+
+// FIXME: ptrace(3C) has this, but exec.go expects the next.
+//func libc_ptrace(request int, pid Pid_t, addr int, data int) int __asm__ ("ptrace")
+
+func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int __asm__ ("ptrace")
+
+var dummy *byte
+const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))
diff -r 6c184227ca86 libgo/syscalls/syscall_solaris_sparc64.go
--- a/libgo/syscalls/syscall_solaris_sparc64.go	Fri Jan 14 10:25:46 2011 +0100
+++ b/libgo/syscalls/syscall_solaris_sparc64.go	Fri Jan 14 17:19:25 2011 +0100
@@ -1,7 +1,21 @@ 
-// syscall_solaris_v9.go -- Solaris sparc9v specific support
+// syscall_solaris_sparc64.go -- Solaris/SPARCV9 specific support
 
 // Copyright 2011 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
 package syscall
+
+import "unsafe"
+
+// FIXME: ptrace(3C) has this, but exec.go expects the next.
+//func libc_ptrace(request int, pid Pid_t, addr int, data int) int __asm__ ("ptrace")
+
+// 64-bit ptrace(3C) doesn't exist
+func libc_ptrace(request int, pid Pid_t, addr uintptr, data *byte) int {
+	errno := ENOSYS
+	return -1
+}
+
+var dummy *byte
+const sizeofPtr uintptr = uintptr(unsafe.Sizeof(dummy))