pget (9)
Leading comments
Copyright (c) 2011 Sergey Kandaurov All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or o...
NAME
pget - locate a process by numberSYNOPSIS
In sys/param.h In sys/proc.h Ft int Fn pget pid_t pid int flags struct proc **ppDESCRIPTION
This function takes a Fa pid as its argument, which can be either a process or thread id, and fills a pointer to the Vt proc structure in Fa *pp . In the latter case, a process owning the specified thread is looked for. The operation is performed by invoking the pfind(9) function. The found process is returned locked. For the PGET_HOLD case, it is returned unlocked (but held). The Fn pget function can perform additional manipulations, depending on a Fa flags argument.The Fa flags argument is the logical OR of some subset of:
- PGET_HOLD
- If set, the found process will be held and unlocked.
- PGET_CANSEE
- If set, the found process will be checked for its visibility. See p_cansee9.
- PGET_CANDEBUG
- If set, the found process will be checked for its debuggability. See p_candebug9.
- PGET_ISCURRENT
- If set, the found process will be checked that it matches the current process context.
- PGET_NOTWEXIT
- If set, the found process will be checked that it does not have the process flag P_WEXIT set.
- PGET_NOTINEXEC
- If set, the found process will be checked that it does not have the process flag P_INEXEC set.
- PGET_NOTID
- If set, Fa pid is not assumed as a thread id for values larger than PID_MAX
- PGET_WANTREAD
- If set, the found process will be checked that the caller may get a read access to its structure. A shorthand for (PGET_HOLD | PGET_CANDEBUG | PGET_NOTWEXIT )