processor_bind.c revision 438076eb789b90b4483862b49c4b9c62ba84ed6a
/*
* CDDL HEADER START
*
* 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
* 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 the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/processor.h>
#include <sys/contract_impl.h>
/*
* Bind all the threads of a process to a CPU.
*/
static int
int *error)
{
int err = 0;
int i;
/* skip kernel processes */
*obind = PBIND_NONE;
return (0);
}
do {
if (err == 0)
err = i;
}
return (err);
}
/*
* Bind all the processes of a task to a CPU.
*/
static int
int *error)
{
proc_t *p;
int err = 0;
int i;
return (ESRCH);
do {
if (err == 0)
err = i;
}
return (err);
}
/*
* Bind all the processes in a project to a CPU.
*/
static int
int *error)
{
proc_t *p;
int err = 0;
int i;
continue;
if (err == 0)
err = i;
}
}
return (err);
}
/*
* Bind all the processes in a zone to a CPU.
*/
int
int *error)
{
proc_t *p;
int err = 0;
int i;
continue;
if (err == 0)
err = i;
}
}
return (err);
}
/*
* Bind all the processes in a process contract to a CPU.
*/
int
int *error)
{
proc_t *p;
int err = 0;
int i;
continue;
if (p->p_ct_process == ctp) {
if (err == 0)
err = i;
}
}
return (err);
}
/*
* processor_bind(2) - Processor binding interfaces.
*/
int
{
int ret = 0;
int err = 0;
contract_t *ct;
/*
* Since we might be making a binding to a processor, hold the
* cpu_lock so that the processor cannot be taken offline while
* we do this.
*/
/*
* Check to be sure binding processor ID is valid.
*/
switch (bind) {
default:
break;
case PBIND_NONE:
case PBIND_QUERY:
case PBIND_HARD:
case PBIND_SOFT:
case PBIND_QUERY_TYPE:
break;
}
if (ret) {
}
switch (idtype) {
case P_LWPID:
} else {
int found = 0;
do {
found = 1;
break;
}
if (!found)
}
break;
case P_PID:
/*
* Note. Cannot use dotoprocs here because it doesn't find
* system class processes, which are legal to query.
*/
} else {
}
break;
case P_TASKID:
}
} else {
}
break;
case P_PROJID:
PROJECT_HOLD_FIND)) == NULL) {
} else {
}
break;
case P_ZONEID:
} else {
}
break;
case P_CTID:
} else {
}
break;
case P_CPUID:
else
break;
case P_ALL:
} else {
int i;
do {
continue;
if (ret == 0)
ret = i;
}
break;
default:
/*
* Spec says this is invalid, even though we could
* handle other idtypes.
*/
break;
}
/*
* If no search error occurred, see if any permissions errors did.
*/
if (ret == 0)
sizeof (obind)) == -1)
}