procset.h - procsetstructure and macros
#include <sys/procset.h>
The procset structure offers an extensive and flexible way of identifying sets of processes or LWP(s) upon which some later operation should be performed. This is accomplished by specifying two types of identifiers and a logic operator to be applied on them. The structure contains the following fields:
idop_t p_op; /* operator connecting left/right sets */ idtype_t p_lidtype; /* left set `ID type */ id_t p_lid; /* left set ID */ idtype_t p_ridtype; /* right set ID type */ id_t p_rid; /* right set ID */
The p_lidtype and p_lid members specify the ID type and ID of the left set of processes, while the p_ridtype and p_rid members specify the ID type and ID of the right set. The following ID types can be used:
P_PID process identifier P_PPID parent process identifier P_PGID process group (job control group) identifier P_SID session identifier P_CID scheduling class identifier P_UID user identifier P_GID group identifier P_ALL all processes P_LWPID LWP identifier P_TASKID task identifier P_PROJID project identifier P_POOLID pool identifier P_ZONEID zone identifier P_CTID process contract identifier P_CPUID CPU identifier P_PSETID processor set identifier
The P_MYID identifier can be used in conjunction with any of the above ID types to indicate that the desired ID is that of the calling LWP for the given type. For example, P_PID and P_MYID result in the process identifier of the caller LWP.
The p_op field specifies the logic operation to be performed on the left and right sets. The valid values for p_op are:
Difference: processes in the left set and not in the right set.
Intersection: processes in both left and right sets.
Union: processes in either left or right sets.
Exclusive or: processes in left or right set, but not in both.
The following macro, defined in procset.h, offers a convenient way to initialize a procset structure:
#define setprocset(ps, op, ltype, lid, rtype, rid) \ (psp)->p_op = (op), \ (psp)->p_lidtype = (ltype), \ (psp)->p_lid = (lid), \ (psp)->p_ridtype = (rtype), \ (psp)->p_rid = (rid),
#include <procset.h> procset_t ps; setprocset(&PS, POP_AND, P_PID, P_MYID, P_ALL, 0);Example 2 Specifying the Current LWP in the Current Process
#include <thread.h> #include <procset.h> procset_t ps; setprocset(&PS, POP_AND, P_PID, P_MYID, P_LWPID, thr_self());Example 3 Specifying All LWPs of the Calling User
#include <thread.h> #include <procset.h> procset_t ps; setprocset(&PS, POP_AND, P_UID, P_MYID, P_ALL, 0);Example 4 Specifying All of User 323's Processes That are Running Inside Zone 7
#include <thread.h> #include <procset.h> procset_t ps; setprocset(&PS, POP_AND, P_UID, 323, P_ZONEID, 7);
See attributes(5) for descriptions of the following attributes:
|