Module Name:    src
Committed By:   kamil
Date:           Sat May 25 04:25:14 UTC 2019

Modified Files:
        src/lib/libc/sys: ptrace.2

Log Message:
Update the ptrace(2) documentation

Document that TRAP_EXEC can be returned for PT_SYSCALL.
Document truncated byte transfers.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/lib/libc/sys/ptrace.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.69 src/lib/libc/sys/ptrace.2:1.70
--- src/lib/libc/sys/ptrace.2:1.69	Tue May  1 16:37:23 2018
+++ src/lib/libc/sys/ptrace.2	Sat May 25 04:25:14 2019
@@ -1,7 +1,7 @@
-.\"	$NetBSD: ptrace.2,v 1.69 2018/05/01 16:37:23 kamil Exp $
+.\"	$NetBSD: ptrace.2,v 1.70 2019/05/25 04:25:14 kamil Exp $
 .\"
 .\" This file is in the public domain.
-.Dd May 1, 2018
+.Dd May 25, 2019
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -56,10 +56,6 @@ with
 .Dv si_code
 set to
 .Dv TRAP_EXEC .
-If a program is traced with the
-.Dv PT_SYSCALL
-option enabled,
-this event notifier is disabled.
 If a traced program calls
 .Xr execve 2
 any setuid or setgid bits on the executable being executed will be ignored.
@@ -220,6 +216,11 @@ The value read is returned as the return
 .Eo \&
 .Fn ptrace
 .Ec .
+.Pp
+These operations return success on incomplete and cancelled byte transfers.
+New software shall use
+.Dv PT_IO
+as it allows to check whether a byte transfer was completed.
 .It Dv PT_WRITE_I , Dv PT_WRITE_D
 These requests parallel
 .Dv PT_READ_I
@@ -229,6 +230,10 @@ except that they write rather than read.
 The
 .Fa data
 argument supplies the value to be written.
+.Pp
+New software shall use
+.Dv PT_IO
+as it allows to check whether an operation was completed.
 .It Dv PT_CONTINUE
 The traced process continues execution.
 .Fa addr
@@ -349,6 +354,15 @@ will return
 .Li \-1
 and set
 .Va errno .
+.Pp
+This interface returns success for partial and cancelled byte transfers.
+For an interrupted transfer, a user shall check whether occurred at least
+a single of the following two conditions:
+.Dv piod_len == 0
+and set
+.Va errno .
+Successful but incomplete byte transfers shall be restarted in the place
+where they were stopped.
 .It Dv PT_DUMPCORE
 Makes the process specified in the
 .Fa pid
@@ -799,6 +813,15 @@ or
 .Dv PT_SETFPREGS
 was attempted on a process with no valid register set.
 (This is normally true only of system processes.)
+.It
+A process attempted to set Program Counter to 0 in
+.Dv PT_CONTINUE ,
+.Dv PT_SYSCALL
+or
+.Dv PT_DETACH
+with
+.Dv vm.user_va0_disable
+set to 1.
 .El
 .It Bq Er EPERM
 .Bl -bullet -compact

Reply via email to