summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man9/Makefile6
-rw-r--r--share/man/man9/tfind.9 (renamed from share/man/man9/pfind.9)27
-rw-r--r--sys/arch/amd64/amd64/db_trace.c4
-rw-r--r--sys/arch/arm/arm/db_trace.c4
-rw-r--r--sys/arch/i386/i386/db_trace.c4
-rw-r--r--sys/arch/powerpc/ddb/db_trace.c4
-rw-r--r--sys/arch/sparc64/sparc64/db_trace.c4
-rw-r--r--sys/kern/kern_fork.c4
-rw-r--r--sys/kern/kern_proc.c4
-rw-r--r--sys/kern/kern_sig.c4
-rw-r--r--sys/kern/kern_time.c6
-rw-r--r--sys/kern/sys_generic.c6
-rw-r--r--sys/kern/sys_process.c6
-rw-r--r--sys/sys/proc.h4
14 files changed, 46 insertions, 41 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 03bb5ed57bd..bf0a01351e4 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.284 2016/11/20 12:05:25 mpi Exp $
+# $OpenBSD: Makefile,v 1.285 2017/01/24 00:58:55 mpi Exp $
# $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -25,7 +25,7 @@ MAN= aml_evalnode.9 atomic_add_int.9 atomic_cas_uint.9 \
malloc.9 membar_sync.9 mbuf.9 mbuf_tags.9 md5.9 mi_switch.9 \
microtime.9 ml_init.9 mq_init.9 mutex.9 \
namei.9 \
- panic.9 pci_conf_read.9 pci_intr_map.9 pfind.9 physio.9 pmap.9 \
+ panic.9 pci_conf_read.9 pci_intr_map.9 physio.9 pmap.9 \
pool.9 ppsratecheck.9 printf.9 psignal.9 \
RBT_INIT.9 \
radio.9 arc4random.9 rasops.9 ratecheck.9 refcnt_init.9 resettodr.9 \
@@ -34,7 +34,7 @@ MAN= aml_evalnode.9 atomic_add_int.9 atomic_cas_uint.9 \
sensor_attach.9 \
spl.9 srp_enter.9 srpl_rc_init.9 startuphook_establish.9 \
socreate.9 sosplice.9 style.9 syscall.9 sysctl_int.9 \
- task_add.9 tc_init.9 time_second.9 timeout.9 tsleep.9 tvtohz.9 \
+ task_add.9 tc_init.9 tfind.9 time_second.9 timeout.9 tsleep.9 tvtohz.9 \
uiomove.9 uvm.9 usb_add_task.9 usbd_close_pipe.9 usbd_open_pipe.9 \
usbd_ref_wait.9 usbd_transfer.9 vfs.9 vfs_busy.9 \
vfs_cache.9 vaccess.9 vclean.9 vcount.9 vdevgone.9 vfinddev.9 vflush.9 \
diff --git a/share/man/man9/pfind.9 b/share/man/man9/tfind.9
index d0e71f92868..b4e69ff54b2 100644
--- a/share/man/man9/pfind.9
+++ b/share/man/man9/tfind.9
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pfind.9,v 1.7 2013/06/04 19:27:11 schwarze Exp $
+.\" $OpenBSD: tfind.9,v 1.1 2017/01/24 00:58:55 mpi Exp $
.\"
.\" Copyright (c) 1999 Marc Espie
.\" All rights reserved.
@@ -23,29 +23,34 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: June 4 2013 $
-.Dt PFIND 9
+.Dd $Mdocdate: January 24 2017 $
+.Dt TFIND 9
.Os
.Sh NAME
-.Nm pfind ,
+.Nm tfind ,
+.Nm prfind ,
.Nm pgfind
-.Nd find process / process group by number
+.Nd find thread, process and process group by number
.Sh SYNOPSIS
-.In sys/cdefs.h
+.In sys/types.h
+.In sys/signal.h
.In sys/proc.h
.Ft "struct proc *"
-.Fn pfind "pid_t pid"
+.Fn tfind "pid_t tid"
+.Ft "struct process *"
+.Fn prfind "pid_t pid"
.Ft "struct pgrp *"
.Fn pgfind "pid_t pgid"
.Sh DESCRIPTION
The
-.Fn pfind
+.Fn tfind ,
+.Fn prfind ,
and
.Fn pgfind
-functions retrieve process and progress group structures from process and
-process group IDs.
+functions retrieve thread, process and progress group structures from thread,
+process and process group IDs, respectively.
.Pp
-Both functions return
+These functions return
.Dv NULL
if the requested ID can't be found.
.Sh CODE REFERENCES
diff --git a/sys/arch/amd64/amd64/db_trace.c b/sys/arch/amd64/amd64/db_trace.c
index d8d297c7f78..3615b2c84df 100644
--- a/sys/arch/amd64/amd64/db_trace.c
+++ b/sys/arch/amd64/amd64/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.23 2016/09/16 19:13:16 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.24 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */
/*
@@ -181,7 +181,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count,
callpc = (db_addr_t)ddb_regs.tf_rip;
} else {
if (trace_proc) {
- struct proc *p = pfind((pid_t)addr);
+ struct proc *p = tfind((pid_t)addr);
if (p == NULL) {
(*pr) ("not found\n");
return;
diff --git a/sys/arch/arm/arm/db_trace.c b/sys/arch/arm/arm/db_trace.c
index 202fb08d0fd..59c2ed65dab 100644
--- a/sys/arch/arm/arm/db_trace.c
+++ b/sys/arch/arm/arm/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.9 2016/09/20 08:35:25 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.10 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $ */
/*
@@ -104,7 +104,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
struct proc *p;
struct user *u;
(*pr) ("trace: pid %d ", (int)addr);
- p = pfind(addr);
+ p = tfind(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff --git a/sys/arch/i386/i386/db_trace.c b/sys/arch/i386/i386/db_trace.c
index 87821c2e03a..0a49cdbae50 100644
--- a/sys/arch/i386/i386/db_trace.c
+++ b/sys/arch/i386/i386/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.22 2016/09/18 13:38:01 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.23 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */
/*
@@ -195,7 +195,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count,
} else if (trace_thread) {
(*pr) ("%s: can't trace thread\n", __func__);
} else if (trace_proc) {
- struct proc *p = pfind((pid_t)addr);
+ struct proc *p = tfind((pid_t)addr);
if (p == NULL) {
(*pr) ("not found\n");
return;
diff --git a/sys/arch/powerpc/ddb/db_trace.c b/sys/arch/powerpc/ddb/db_trace.c
index 21a19f75436..a8a1cd591a3 100644
--- a/sys/arch/powerpc/ddb/db_trace.c
+++ b/sys/arch/powerpc/ddb/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.10 2016/09/10 06:36:26 jasper Exp $ */
+/* $OpenBSD: db_trace.c,v 1.11 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */
/*
@@ -134,7 +134,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
lr = ddb_regs.srr0;
} else {
if (trace_proc) {
- struct proc *p = pfind((pid_t)addr);
+ struct proc *p = tfind((pid_t)addr);
if (p == NULL) {
(*pr) ("not found\n");
return;
diff --git a/sys/arch/sparc64/sparc64/db_trace.c b/sys/arch/sparc64/sparc64/db_trace.c
index 0aaaec3a3fc..aba94187a59 100644
--- a/sys/arch/sparc64/sparc64/db_trace.c
+++ b/sys/arch/sparc64/sparc64/db_trace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_trace.c,v 1.12 2016/09/11 03:14:04 guenther Exp $ */
+/* $OpenBSD: db_trace.c,v 1.13 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
/*
@@ -78,7 +78,7 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
struct proc *p;
struct user *u;
(*pr)("trace: pid %d ", (int)addr);
- p = pfind(addr);
+ p = tfind(addr);
if (p == NULL) {
(*pr)("not found\n");
return;
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 9a82d5bbe56..3ff2085f732 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_fork.c,v 1.192 2016/11/07 00:26:32 guenther Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.193 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
@@ -559,7 +559,7 @@ alloctid(void)
do {
/* (0 .. TID_MASK+1] */
tid = 1 + (arc4random() & TID_MASK);
- } while (pfind(tid) != NULL);
+ } while (tfind(tid) != NULL);
return (tid);
}
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index ddf08ab2f12..5154d57722c 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_proc.c,v 1.72 2017/01/21 05:42:03 guenther Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.73 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
@@ -169,7 +169,7 @@ inferior(struct process *pr, struct process *parent)
* Locate a proc (thread) by number
*/
struct proc *
-pfind(pid_t tid)
+tfind(pid_t tid)
{
struct proc *p;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index b40eac85f90..e1b2113b197 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.207 2017/01/21 05:42:03 guenther Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.208 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -617,7 +617,7 @@ sys_thrkill(struct proc *cp, void *v, register_t *retval)
if (((u_int)signum) >= NSIG)
return (EINVAL);
if (tid > THREAD_PID_OFFSET) {
- if ((p = pfind(tid - THREAD_PID_OFFSET)) == NULL)
+ if ((p = tfind(tid - THREAD_PID_OFFSET)) == NULL)
return (ESRCH);
/* can only kill threads in the same process */
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 64083f9ccde..8193c4eda43 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_time.c,v 1.98 2016/09/03 14:46:56 naddy Exp $ */
+/* $OpenBSD: kern_time.c,v 1.99 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
@@ -141,7 +141,7 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp)
default:
/* check for clock from pthread_getcpuclockid() */
if (__CLOCK_TYPE(clock_id) == CLOCK_THREAD_CPUTIME_ID) {
- q = pfind(__CLOCK_PTID(clock_id) - THREAD_PID_OFFSET);
+ q = tfind(__CLOCK_PTID(clock_id) - THREAD_PID_OFFSET);
if (q == NULL || q->p_p != p->p_p)
return (ESRCH);
*tp = q->p_tu.tu_runtime;
@@ -232,7 +232,7 @@ sys_clock_getres(struct proc *p, void *v, register_t *retval)
default:
/* check for clock from pthread_getcpuclockid() */
if (__CLOCK_TYPE(clock_id) == CLOCK_THREAD_CPUTIME_ID) {
- q = pfind(__CLOCK_PTID(clock_id) - THREAD_PID_OFFSET);
+ q = tfind(__CLOCK_PTID(clock_id) - THREAD_PID_OFFSET);
if (q == NULL || q->p_p != p->p_p)
return (ESRCH);
ts.tv_sec = 0;
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index cf08a3022be..b1d3f7b6951 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.113 2016/11/07 00:26:33 guenther Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.114 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -783,7 +783,7 @@ selrecord(struct proc *selector, struct selinfo *sip)
mytid = selector->p_tid;
if (sip->si_seltid == mytid)
return;
- if (sip->si_seltid && (p = pfind(sip->si_seltid)) &&
+ if (sip->si_seltid && (p = tfind(sip->si_seltid)) &&
p->p_wchan == (caddr_t)&selwait)
sip->si_flags |= SI_COLL;
else
@@ -807,7 +807,7 @@ selwakeup(struct selinfo *sip)
sip->si_flags &= ~SI_COLL;
wakeup(&selwait);
}
- p = pfind(sip->si_seltid);
+ p = tfind(sip->si_seltid);
sip->si_seltid = 0;
if (p != NULL) {
SCHED_LOCK(s);
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 7c7b261cba3..90c67769caa 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_process.c,v 1.74 2016/11/07 00:26:33 guenther Exp $ */
+/* $OpenBSD: sys_process.c,v 1.75 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */
/*-
@@ -156,7 +156,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
case PT_SETXMMREGS:
#endif
if (SCARG(uap, pid) > THREAD_PID_OFFSET) {
- t = pfind(SCARG(uap, pid) - THREAD_PID_OFFSET);
+ t = tfind(SCARG(uap, pid) - THREAD_PID_OFFSET);
if (t == NULL)
return (ESRCH);
tr = t->p_p;
@@ -316,7 +316,7 @@ sys_ptrace(struct proc *p, void *v, register_t *retval)
if (error)
return (error);
- t = pfind(pts.pts_tid - THREAD_PID_OFFSET);
+ t = tfind(pts.pts_tid - THREAD_PID_OFFSET);
if (t == NULL || ISSET(t->p_flag, P_WEXIT))
return (ESRCH);
if (t->p_p != tr)
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 66c6ff522a5..4aa3587f5f6 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.229 2017/01/21 05:42:03 guenther Exp $ */
+/* $OpenBSD: proc.h,v 1.230 2017/01/24 00:58:55 mpi Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
@@ -501,7 +501,7 @@ void freepid(pid_t);
struct process *prfind(pid_t); /* Find process by id. */
struct process *zombiefind(pid_t); /* Find zombie process by id. */
-struct proc *pfind(pid_t); /* Find thread by id. */
+struct proc *tfind(pid_t); /* Find thread by id. */
struct pgrp *pgfind(pid_t); /* Find process group by id. */
void proc_printit(struct proc *p, const char *modif,
int (*pr)(const char *, ...));