1 '\" te
2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
4 .\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
5 .\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH PROCESSOR_BIND 2 "Mar 13, 2009"
7 .SH NAME
8 processor_bind \- bind LWPs to a processor
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/types.h>
13 #include <sys/processor.h>
14 #include <sys/procset.h>
15
16 \fBint\fR \fBprocessor_bind\fR(\fBidtype_t\fR \fIidtype\fR, \fBid_t\fR \fIid\fR, \fBprocessorid_t\fR \fIprocessorid\fR,
17 \fBprocessorid_t *\fR\fIobind\fR);
18 .fi
19
20 .SH DESCRIPTION
21 .sp
22 .LP
23 The \fBprocessor_bind()\fR function binds the LWP (lightweight process) or set
24 of LWPs specified by \fIidtype\fR and \fIid\fR to the processor specified by
25 \fIprocessorid\fR. If \fIobind\fR is not \fINULL\fR, this function also sets
26 the \fBprocessorid_t\fR variable pointed to by \fIobind\fR to the previous
27 binding of one of the specified LWPs, or to \fBPBIND_NONE\fR if the selected
28 LWP was not bound.
29 .sp
30 .LP
31 If \fIidtype\fR is \fBP_PID\fR, the binding affects all LWPs of the process
32 with process ID (PID) \fIid\fR.
33 .sp
34 .LP
35 If \fIidtype\fR is \fBP_LWPID\fR, the binding affects the LWP of the current
36 process with LWP ID \fIid\fR.
37 .sp
38 .LP
39 If \fIidtype\fR is \fBP_TASKID\fR, the binding affects all LWPs of all
40 processes with task ID \fIid\fR.
41 .sp
42 .LP
43 If \fIidtype\fR is \fBP_PROJID\fR, the binding affects all LWPs of all
44 processes with project ID \fIid\fR.
45 .sp
46 .LP
47 If \fIidtype\fR is \fBP_CTID\fR, the binding affects all LWPs of all processes
48 with process contract ID \fIid\fR.
49 .sp
50 .LP
51 If \fIidtype\fR is \fBP_ZONEID\fR, the binding affects all LWPs of all
52 processes with zone ID \fIid\fR.
53 .sp
54 .LP
55 If \fIid\fR is \fBP_MYID\fR, the specified LWP, process, task, or project is
56 the current one.
57 .sp
58 .LP
59 If \fIprocessorid\fR is \fBPBIND_NONE\fR, the processor bindings of the
60 specified LWPs are cleared.
61 .sp
62 .LP
63 If \fIprocessorid\fR is \fBPBIND_QUERY\fR, the processor bindings are not
64 changed.
65 .sp
66 .LP
67 The {\fBPRIV_PROC_OWNER\fR} privilege must be asserted in the effective set of
68 the calling process or the real or effective user ID of the calling process
69 must match the real or effective user ID of the \fBLWP\fRs being bound. If the
70 calling process does not have permission to change all of the specified LWPs,
71 the bindings of the LWPs for which it does have permission will be changed even
72 though an error is returned.
73 .sp
74 .LP
75 Processor bindings are inherited across \fBfork\fR(2) and \fBexec\fR(2).
76 .SH RETURN VALUES
77 .sp
78 .LP
79 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
80 returned and \fBerrno\fR is set to indicate the error.
81 .SH ERRORS
82 .sp
83 .LP
84 The \fBprocessor_bind()\fR function will fail if:
85 .sp
86 .ne 2
87 .na
88 \fB\fBEFAULT\fR\fR
89 .ad
90 .RS 11n
91 The location pointed to by \fIobind\fR was not \fINULL\fR and not writable by
92 the user.
93 .RE
94
95 .sp
96 .ne 2
97 .na
98 \fB\fBEINVAL\fR\fR
99 .ad
100 .RS 11n
101 The specified processor is not on-line, or the \fIidtype\fR argument was not
102 \fBP_PID\fR, \fBP_LWPID\fR, \fBP_PROJID\fR, \fBP_TASKID\fR, \fBP_CTID\fR, or
103 \fBP_ZONEID\fR.
104 .sp
105 The caller is in a non-global zone, the pools facility is active, and the
106 processor is not a member of the zone's pool's processor set.
107 .RE
108
109 .sp
110 .ne 2
111 .na
112 \fB\fBENOTSUP\fR\fR
113 .ad
114 .RS 11n
115 Binding a system process to a processor set is not supported.
116 .RE
117
118 .sp
119 .ne 2
120 .na
121 \fB\fBEPERM\fR\fR
122 .ad
123 .RS 11n
124 The {\fBPRIV_PROC_OWNER\fR} privilege is not asserted in the effective set of
125 the calling process and its real or effective user ID does not match the real
126 or effective user \fBID\fR of one of the \fBLWP\fRs being bound.
127 .RE
128
129 .sp
130 .ne 2
131 .na
132 \fB\fBESRCH\fR\fR
133 .ad
134 .RS 11n
135 No processes, \fBLWP\fRs, or tasks were found to match the criteria specified
136 by \fIidtype\fR and \fIid\fR.
137 .RE
138
139 .SH ATTRIBUTES
140 .sp
141 .LP
142 See \fBattributes\fR(5) for descriptions of the following attributes:
143 .sp
144
145 .sp
146 .TS
147 box;
148 c | c
149 l | l .
150 ATTRIBUTE TYPE ATTRIBUTE VALUE
151 _
152 Interface Stability Committed
153 _
154 MT-Level Async-Signal-Safe
155 .TE
156
157 .SH SEE ALSO
158 .sp
159 .LP
160 \fBpooladm\fR(1M), \fBpsradm\fR(1M), \fBpsrinfo\fR(1M), \fBzoneadm\fR(1M),
161 \fBexec\fR(2), \fBfork\fR(2), \fBp_online\fR(2), \fBpset_bind\fR(2),
162 \fBsysconf\fR(3C), \fBprocess\fR(4), \fBproject\fR(4), \fBattributes\fR(5),
163 \fBprivileges\fR(5)