summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys
diff options
context:
space:
mode:
authord <d@openbsd.org>1999-02-01 08:13:01 +0000
committerd <d@openbsd.org>1999-02-01 08:13:01 +0000
commit2879b7bc6c32607cf98ba3d043843ecac619119c (patch)
tree4a4011963a208d3ad7abaac6e281da1263d5a27c /lib/libc/sys
parentmalloc can't use write() if it fails very early, so use the unwrapped syscall _thread_sys_write() if we are threaded (diff)
downloadwireguard-openbsd-2879b7bc6c32607cf98ba3d043843ecac619119c.tar.xz
wireguard-openbsd-2879b7bc6c32607cf98ba3d043843ecac619119c.zip
mi ptrace
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/Lint_ptrace.c20
-rw-r--r--lib/libc/sys/Makefile.inc12
-rw-r--r--lib/libc/sys/ptrace.24
-rw-r--r--lib/libc/sys/ptrace.c21
4 files changed, 29 insertions, 28 deletions
diff --git a/lib/libc/sys/Lint_ptrace.c b/lib/libc/sys/Lint_ptrace.c
deleted file mode 100644
index 895f672b081..00000000000
--- a/lib/libc/sys/Lint_ptrace.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: Lint_ptrace.c,v 1.1 1998/02/08 22:45:10 tholo Exp $ */
-/* $NetBSD: Lint_ptrace.c,v 1.1 1997/11/06 00:53:02 cgd Exp $ */
-
-/*
- * This file placed in the public domain.
- * Chris Demetriou, November 5, 1997.
- */
-
-#include <unistd.h>
-
-/*ARGSUSED*/
-int
-ptrace(request, pid, addr, data)
- int request;
- pid_t pid;
- caddr_t addr;
- int data;
-{
- return (0);
-}
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 3bc64a19d3e..59cac8d9641 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.27 1998/11/20 11:18:52 d Exp $
+# $OpenBSD: Makefile.inc,v 1.28 1999/02/01 08:13:01 d Exp $
# $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $
# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
@@ -6,22 +6,22 @@
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/sys ${LIBCSRCDIR}/sys
# modules with non-default implementations on at least one architecture:
-SRCS+= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S ptrace.S \
+SRCS+= Ovfork.S brk.S cerror.S exect.S fork.S pipe.S \
sbrk.S sigpending.S sigprocmask.S sigreturn.S \
sigsuspend.S syscall.S
LSRCS+= Lint_Ovfork.c Lint_brk.c Lint_exect.c Lint_fork.c \
- Lint_pipe.c Lint_ptrace.c Lint_sbrk.c \
+ Lint_pipe.c Lint_sbrk.c \
Lint_sigpending.c Lint_sigprocmask.c Lint_sigreturn.c \
Lint_sigsuspend.c Lint_syscall.c
DPSRCS+= Lint_Ovfork.c Lint_brk.c Lint_exect.c Lint_fork.c \
- Lint_pipe.c Lint_ptrace.c Lint_sbrk.c \
+ Lint_pipe.c Lint_sbrk.c \
Lint_sigpending.c Lint_sigprocmask.c Lint_sigreturn.c \
Lint_sigsuspend.c Lint_syscall.c
# glue to provide compatibility between GCC 1.X and 2.X and for compat
# with old syscall interfaces.
-SRCS+= ftruncate.c lseek.c mmap.c semctl.c truncate.c \
+SRCS+= ftruncate.c lseek.c mmap.c ptrace.c semctl.c truncate.c \
timer_create.c timer_delete.c timer_getoverrun.c timer_gettime.c \
timer_settime.c
@@ -58,7 +58,7 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \
PASM= ${ASM:.o=.po}
SASM= ${ASM:.o=.so}
-PSEUDO= _exit.o _getlogin.o _setlogin.o
+PSEUDO= _exit.o _getlogin.o _setlogin.o _ptrace.o
PPSEUDO=${PSEUDO:.o=.po}
SPSEUDO=${PSEUDO:.o=.so}
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
index b3590325cb5..2596924be74 100644
--- a/lib/libc/sys/ptrace.2
+++ b/lib/libc/sys/ptrace.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ptrace.2,v 1.3 1996/10/08 01:20:12 michaels Exp $
+.\" $OpenBSD: ptrace.2,v 1.4 1999/02/01 08:13:01 d Exp $
.\" $NetBSD: ptrace.2,v 1.3 1996/02/23 01:39:41 jtc Exp $
.\"
.\" This file is in the public domain.
@@ -303,7 +303,7 @@ to return
.Li -1
as a non-error value; to disambiguate,
.Va errno
-can be set to 0 before the call and checked afterwards. The possible
+is set to zero and this should be checked. The possible
errors are:
.Bl -tag -width 4n
.It Bq Er ESRCH
diff --git a/lib/libc/sys/ptrace.c b/lib/libc/sys/ptrace.c
new file mode 100644
index 00000000000..5e95a94941c
--- /dev/null
+++ b/lib/libc/sys/ptrace.c
@@ -0,0 +1,21 @@
+/* $OpenBSD: ptrace.c,v 1.1 1999/02/01 08:13:01 d Exp $ */
+/* David Leonard <d@openbsd.org>, 1999. Public domain. */
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/errno.h>
+
+int _ptrace __P((int, pid_t, caddr_t, int));
+
+int
+ptrace(request, pid, addr, data)
+ int request;
+ pid_t pid;
+ caddr_t addr;
+ int data;
+{
+
+ /* ptrace(2) is documented to clear errno on success: */
+ errno = 0;
+ return (_ptrace(request, pid, addr, data));
+}