From bc2fda9c8995b3dc8915e5bccb399ab0dcb36d72 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 14 Jul 2009 11:59:19 -0700 Subject: [PATCH] Regenerate Linux 386 syscall bindings to add ptrace. R=rsc APPROVED=rsc DELTA=82 (80 added, 2 deleted, 0 changed) OCL=31610 CL=31612 --- src/pkg/syscall/zsyscall_linux_386.go | 6 +++ src/pkg/syscall/ztypes_linux_386.go | 76 ++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/pkg/syscall/zsyscall_linux_386.go b/src/pkg/syscall/zsyscall_linux_386.go index 07629aa6a7..11d08d2c7a 100644 --- a/src/pkg/syscall/zsyscall_linux_386.go +++ b/src/pkg/syscall/zsyscall_linux_386.go @@ -42,6 +42,12 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return; } +func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) { + r0, r1, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0); + errno = int(e1); + return; +} + func Access(path string, mode int) (errno int) { r0, r1, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0); errno = int(e1); diff --git a/src/pkg/syscall/ztypes_linux_386.go b/src/pkg/syscall/ztypes_linux_386.go index 9d4190133e..a3b1e6b79a 100644 --- a/src/pkg/syscall/ztypes_linux_386.go +++ b/src/pkg/syscall/ztypes_linux_386.go @@ -49,6 +49,9 @@ const ( WSTOPPED = 0x2; WCONTINUED = 0x8; WNOWAIT = 0x1000000; + WCLONE = 0x80000000; + WALL = 0x40000000; + WNOTHREAD = 0x20000000; AF_UNIX = 0x1; AF_INET = 0x2; AF_INET6 = 0xa; @@ -74,6 +77,43 @@ const ( SizeofSockaddrInet6 = 0x1c; SizeofSockaddrAny = 0x1c; SizeofSockaddrUnix = 0x6e; + _PTRACE_TRACEME = 0; + _PTRACE_PEEKTEXT = 0x1; + _PTRACE_PEEKDATA = 0x2; + _PTRACE_PEEKUSER = 0x3; + _PTRACE_POKETEXT = 0x4; + _PTRACE_POKEDATA = 0x5; + _PTRACE_POKEUSER = 0x6; + _PTRACE_CONT = 0x7; + _PTRACE_KILL = 0x8; + _PTRACE_SINGLESTEP = 0x9; + _PTRACE_GETREGS = 0xc; + _PTRACE_SETREGS = 0xd; + _PTRACE_GETFPREGS = 0xe; + _PTRACE_SETFPREGS = 0xf; + _PTRACE_ATTACH = 0x10; + _PTRACE_DETACH = 0x11; + _PTRACE_GETFPXREGS = 0x12; + _PTRACE_SETFPXREGS = 0x13; + _PTRACE_SYSCALL = 0x18; + _PTRACE_SETOPTIONS = 0x4200; + _PTRACE_GETEVENTMSG = 0x4201; + _PTRACE_GETSIGINFO = 0x4202; + _PTRACE_SETSIGINFO = 0x4203; + PTRACE_O_TRACESYSGOOD = 0x1; + PTRACE_O_TRACEFORK = 0x2; + PTRACE_O_TRACEVFORK = 0x4; + PTRACE_O_TRACECLONE = 0x8; + PTRACE_O_TRACEEXEC = 0x10; + PTRACE_O_TRACEVFORKDONE = 0x20; + PTRACE_O_TRACEEXIT = 0x40; + PTRACE_O_MASK = 0x7f; + PTRACE_EVENT_FORK = 0x1; + PTRACE_EVENT_VFORK = 0x2; + PTRACE_EVENT_CLONE = 0x3; + PTRACE_EVENT_EXEC = 0x4; + PTRACE_EVENT_VFORK_DONE = 0x5; + PTRACE_EVENT_EXIT = 0x6; EPOLLIN = 0x1; EPOLLRDHUP = 0x2000; EPOLLOUT = 0x4; @@ -85,6 +125,14 @@ const ( // Types +type _C_short int16 + +type _C_int int32 + +type _C_long int32 + +type _C_long_long int64 + type Timespec struct { Sec int32; Nsec int32; @@ -167,8 +215,6 @@ type Rlimit struct { Max uint64; } -type _C_int int32 - type _Gid_t uint32 type Stat_t struct { @@ -252,6 +298,32 @@ type Linger struct { Linger int32; } +type PtraceRegs struct { + Ebx int32; + Ecx int32; + Edx int32; + Esi int32; + Edi int32; + Ebp int32; + Eax int32; + Ds uint16; + __ds uint16; + Es uint16; + __es uint16; + Fs uint16; + __fs uint16; + Gs uint16; + __gs uint16; + Eax int32; + Eip int32; + Cs uint16; + __cs uint16; + Eflags int32; + Esp int32; + Ss uint16; + __ss uint16; +} + type FdSet struct { Bits [32]int32; } -- 2.48.1