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 "Dec 27, 2015"
   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 .LP
  22 The \fBprocessor_bind()\fR function binds the LWP (lightweight process) or set
  23 of LWPs specified by \fIidtype\fR and \fIid\fR to the processor specified by
  24 \fIprocessorid\fR. If \fIobind\fR is not \fINULL\fR, this function also sets
  25 the \fBprocessorid_t\fR variable pointed to by \fIobind\fR to the previous
  26 binding of one of the specified LWPs, or to \fBPBIND_NONE\fR if the selected
  27 LWP was not bound.
  28 .sp
  29 .LP
  30 If \fIidtype\fR is \fBP_PID\fR, the binding affects all LWPs of the process
  31 with process ID (PID) \fIid\fR.
  32 .sp
  33 .LP
  34 If \fIidtype\fR is \fBP_LWPID\fR, the binding affects the LWP of the current
  35 process with LWP ID \fIid\fR.
  36 .sp
  37 .LP
  38 If \fIidtype\fR is \fBP_TASKID\fR, the binding affects all LWPs of all
  39 processes with task ID \fIid\fR.
  40 .sp
  41 .LP
  42 If \fIidtype\fR is \fBP_PROJID\fR, the binding affects all LWPs of all
  43 processes with project ID \fIid\fR.
  44 .sp
  45 .LP
  46 If \fIidtype\fR is \fBP_CTID\fR, the binding affects all LWPs of all processes
  47 with process contract ID \fIid\fR.
  48 .sp
  49 .LP
  50 If \fIidtype\fR is \fBP_ZONEID\fR, the binding affects all LWPs of all
  51 processes with zone ID \fIid\fR.
  52 .sp
  53 .LP
  54 If \fIid\fR is \fBP_MYID\fR, the specified LWP, process, task, or project is
  55 the current one.
  56 .sp
  57 .LP
  58 If \fIprocessorid\fR is \fBPBIND_NONE\fR, the processor bindings of the
  59 specified LWPs are cleared.
  60 .sp
  61 .LP
  62 If \fIprocessorid\fR is \fBPBIND_QUERY\fR, the processor bindings are not
  63 changed.
  64 .sp
  65 .LP
  66 The {\fBPRIV_PROC_OWNER\fR} privilege must be asserted in the effective set of
  67 the calling process or the real or effective user ID of the calling process
  68 must match the real or effective user ID of the \fBLWP\fRs being bound.  If the
  69 calling process does not have permission to change all of the specified LWPs,
  70 the bindings of the LWPs for which it does have permission will be changed even
  71 though an error is returned.
  72 .sp
  73 .LP
  74 Processor bindings are inherited across \fBfork\fR(2) and \fBexec\fR(2).
  75 .SH RETURN VALUES
  76 .LP
  77 Upon successful completion, \fB0\fR is returned.  Otherwise, \fB\(mi1\fR is
  78 returned and  \fBerrno\fR is set to indicate the error.
  79 .SH ERRORS
  80 .LP
  81 The \fBprocessor_bind()\fR function will fail if:
  82 .sp
  83 .ne 2
  84 .na
  85 \fB\fBEFAULT\fR\fR
  86 .ad
  87 .RS 11n
  88 The location pointed to by \fIobind\fR was not \fINULL\fR and not writable by
  89 the user.
  90 .RE
  91 
  92 .sp
  93 .ne 2
  94 .na
  95 \fB\fBEINVAL\fR\fR
  96 .ad
  97 .RS 11n
  98 The processor is not on-line.
  99 .sp
 100 The LWP is bound to a processor set or resource pool for which the
 101 processor is not a member.
 102 .sp
 103 The \fIidtype\fR argument is not \fBP_PID\fR, \fBP_LWPID\fR,
 104 \fBP_PROJID\fR, \fBP_TASKID\fR, \fBP_CTID\fR, or \fBP_ZONEID\fR.
 105 .RE
 106 
 107 .sp
 108 .ne 2
 109 .na
 110 \fB\fBENOTSUP\fR\fR
 111 .ad
 112 .RS 11n
 113 Binding a system process to a processor set is not supported.
 114 .RE
 115 
 116 .sp
 117 .ne 2
 118 .na
 119 \fB\fBEPERM\fR\fR
 120 .ad
 121 .RS 11n
 122 The {\fBPRIV_PROC_OWNER\fR} privilege is not asserted in the effective set of
 123 the calling process and its real or effective user ID does not match the real
 124 or effective user \fBID\fR of one of the \fBLWP\fRs being bound.
 125 .RE
 126 
 127 .sp
 128 .ne 2
 129 .na
 130 \fB\fBESRCH\fR\fR
 131 .ad
 132 .RS 11n
 133 No processes, \fBLWP\fRs, or tasks were found to match the criteria specified
 134 by \fIidtype\fR and \fIid\fR.
 135 .RE
 136 
 137 .SH ATTRIBUTES
 138 See \fBattributes\fR(5) for descriptions of the following attributes:
 139 .sp
 140 
 141 .sp
 142 .TS
 143 box;
 144 c | c
 145 l | l .
 146 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 147 _
 148 Interface Stability     Committed
 149 _
 150 MT-Level        Async-Signal-Safe
 151 .TE
 152 
 153 .SH SEE ALSO
 154 \fBpooladm\fR(1M), \fBpsradm\fR(1M), \fBpsrinfo\fR(1M), \fBzoneadm\fR(1M),
 155 \fBexec\fR(2), \fBfork\fR(2), \fBp_online\fR(2), \fBpset_bind\fR(2),
 156 \fBsysconf\fR(3C), \fBprocess\fR(4), \fBproject\fR(4), \fBattributes\fR(5),
 157 \fBprivileges\fR(5)