1.\" $OpenBSD: tfind.9,v 1.2 2024/12/24 07:10:18 tb Exp $ 2.\" 3.\" Copyright (c) 1999 Marc Espie 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" 26.Dd $Mdocdate: December 24 2024 $ 27.Dt TFIND 9 28.Os 29.Sh NAME 30.Nm tfind , 31.Nm prfind , 32.Nm pgfind 33.Nd find thread, process and process group by number 34.Sh SYNOPSIS 35.In sys/types.h 36.In sys/signal.h 37.In sys/proc.h 38.Ft "struct proc *" 39.Fn tfind "pid_t tid" 40.Ft "struct process *" 41.Fn prfind "pid_t pid" 42.Ft "struct pgrp *" 43.Fn pgfind "pid_t pgid" 44.Sh DESCRIPTION 45The 46.Fn tfind , 47.Fn prfind , 48and 49.Fn pgfind 50functions retrieve thread, process and process group structures from thread, 51process and process group IDs, respectively. 52.Pp 53These functions return 54.Dv NULL 55if the requested ID can't be found. 56.Sh CODE REFERENCES 57Those functions are implemented in the file 58.Pa sys/kern/kern_proc.c . 59