Skip to content

Commit 55b11dc

Browse files
bradfitzgopherbot
authored andcommitted
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 <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Brad Fitzpatrick <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 5059a07 commit 55b11dc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

unix/syscall_linux.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
package unix
1313

1414
import (
15-
"debug/elf"
1615
"encoding/binary"
1716
"strconv"
1817
"syscall"
@@ -1700,18 +1699,23 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
17001699
return ptracePoke(PTRACE_POKEUSR, PTRACE_PEEKUSR, pid, addr, data)
17011700
}
17021701

1702+
// elfNT_PRSTATUS is a copy of the debug/elf.NT_PRSTATUS constant so
1703+
// x/sys/unix doesn't need to depend on debug/elf and thus
1704+
// compress/zlib, debug/dwarf, and other packages.
1705+
const elfNT_PRSTATUS = 1
1706+
17031707
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
17041708
var iov Iovec
17051709
iov.Base = (*byte)(unsafe.Pointer(regsout))
17061710
iov.SetLen(int(unsafe.Sizeof(*regsout)))
1707-
return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov))
1711+
return ptracePtr(PTRACE_GETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
17081712
}
17091713

17101714
func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
17111715
var iov Iovec
17121716
iov.Base = (*byte)(unsafe.Pointer(regs))
17131717
iov.SetLen(int(unsafe.Sizeof(*regs)))
1714-
return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elf.NT_PRSTATUS), unsafe.Pointer(&iov))
1718+
return ptracePtr(PTRACE_SETREGSET, pid, uintptr(elfNT_PRSTATUS), unsafe.Pointer(&iov))
17151719
}
17161720

17171721
func PtraceSetOptions(pid int, options int) (err error) {

0 commit comments

Comments
 (0)