Current File : //usr/share/man/man3head/procset.h.3head
'\" te
.\" Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
.TH procset.h 3HEAD "31 Dec 2013" "SunOS 5.11" "Headers"
.SH NAME
procset.h \- \fBprocset\fR structure and macros
.SH SYNOPSIS
.LP
.nf
#include <sys/procset.h>
.fi

.SH DESCRIPTION
.sp
.LP
The \fBprocset\fR 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:
.sp
.in +2
.nf
	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 */
.fi
.in -2

.sp
.LP
The \fBp_lidtype\fR and \fBp_lid\fR members specify the ID type and ID of the \fBleft\fR set of processes, while the \fBp_ridtype\fR and \fBp_rid\fR members specify the ID type and ID of the \fBright\fR set. The following ID types can be used:
.sp
.in +2
.nf
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
.fi
.in -2

.sp
.LP
The \fBP_MYID\fR 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, \fBP_PID\fR and \fBP_MYID\fR result in the process identifier of the caller LWP.
.sp
.LP
The \fBp_op\fR field specifies the logic operation to be performed on the left and right sets. The valid values for \fBp_op\fR are:
.sp
.ne 2
.mk
.na
\fB\fBPOP_DIFF\fR\fR
.ad
.RS 12n
.rt  
Difference: processes in the left set and not in the right set.
.RE

.sp
.ne 2
.mk
.na
\fB\fBPOP_AND\fR\fR
.ad
.RS 12n
.rt  
Intersection: processes in both left and right sets.
.RE

.sp
.ne 2
.mk
.na
\fB\fBPOP_OR\fR\fR
.ad
.RS 12n
.rt  
Union: processes in either left or right sets.
.RE

.sp
.ne 2
.mk
.na
\fB\fBPOP_XOR\fR\fR
.ad
.RS 12n
.rt  
Exclusive or: processes in left or right set, but not in both.
.RE

.sp
.LP
The following macro, defined in \fBprocset.h\fR, offers a convenient way to initialize a \fBprocset\fR structure:
.sp
.in +2
.nf
#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),
.fi
.in -2

.SH EXAMPLES
.LP
\fBExample 1 \fRSpecifying All LWPs in the Current Process
.sp
.in +2
.nf
#include <procset.h>
procset_t ps;
	setprocset(&PS, POP_AND, P_PID, P_MYID, P_ALL, 0);
.fi
.in -2

.LP
\fBExample 2 \fRSpecifying the Current LWP in the Current Process
.sp
.in +2
.nf
#include <thread.h>
#include <procset.h>

procset_t ps;
	setprocset(&PS, POP_AND, P_PID, P_MYID, P_LWPID, thr_self());
.fi
.in -2

.LP
\fBExample 3 \fRSpecifying All LWPs of the Calling User
.sp
.in +2
.nf
#include <thread.h>
#include <procset.h>

procset_t ps;
	setprocset(&PS, POP_AND, P_UID, P_MYID, P_ALL, 0);
.fi
.in -2

.LP
\fBExample 4 \fRSpecifying All of User 323's Processes That are Running Inside \fBZone 7\fR
.sp
.in +2
.nf
#include <thread.h>
#include <procset.h>

procset_t ps;
	setprocset(&PS, POP_AND, P_UID, 323, P_ZONEID, 7);
.fi
.in -2

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Interface StabilityCommitted
_
StandardSee \fBstandards\fR(5).
.TE