unix: remove recently introduced debug/elf dependency
CL 501795 added a dependency on debug/elf (and thus compress/gzip,
debug/dwarf, hash/adler32)
Add a copy of the const instead.
Change-Id: I2c86094ef7de61b8dd0bdd727f6e547ac7f58527
Reviewed-on: https://go-review.googlesource.com/c/sys/+/502356
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index ec24fae..6de486b 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -12,7 +12,6 @@
package unix
import (
- "debug/elf"
"encoding/binary"
"strconv"
"syscall"
@@ -1700,18 +1699,23 @@
return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
}
+// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so
+// x/sys/unix doesn't need to depend on debug/elf and thus
+// compress/zlib, debug/dwarf, and other packages.
+const elfNT_PRSTATUS = 1
+
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
var iov Iovec
iov.Base = (*byte)(unsafe.Pointer(regsout))
iov.SetLen(int(unsafe.Sizeof(*regsout)))
- return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov))
+ return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
}
func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
var iov Iovec
iov.Base = (*byte)(unsafe.Pointer(regs))
iov.SetLen(int(unsafe.Sizeof(*regs)))
- return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov))
+ return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
}
func PtraceSetOptions(pid int, options int) (err error) {