pset.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/sysmacros.h>
#include <sys/pool_pset.h>
static int pset(int, long, long, long, long);
static struct sysent pset_sysent = {
5,
(int (*)())pset,
};
};
#ifdef _SYSCALL32_IMPL
};
#endif
static struct modlinkage modlinkage = {
&modlsys,
#ifdef _SYSCALL32_IMPL
#endif
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
{
}
static int
{
int error;
if (secpolicy_pset(CRED()) != 0)
pool_lock();
if (pool_state == POOL_ENABLED) {
pool_unlock();
}
if (error) {
pool_unlock();
}
(void) cpupart_destroy(newpset);
pool_unlock();
}
pool_unlock();
return (error);
}
static int
{
int error;
if (secpolicy_pset(CRED()) != 0)
pool_lock();
if (pool_state == POOL_ENABLED) {
pool_unlock();
}
pool_unlock();
if (error)
else
return (0);
}
static int
{
int error = 0;
pool_lock();
pool_unlock();
}
pool_unlock();
}
pool_unlock();
if (error)
return (0);
}
static int
{
int pset_type;
int error = 0;
}
KM_SLEEP);
goto out;
/*
* Now copyout the information about this processor set.
*/
/*
* Get number of cpus to copy back. If the user didn't pass in
* a big enough buffer, only copy back as many cpus as fits in
* the buffer but copy back the real number of cpus.
*/
sizeof (processorid_t) * copy_ncpus) != 0) {
goto out;
}
}
else
}
return (0);
out:
}
static int
void *zonebuf)
{
int error = 0;
ASSERT(pool_lock_held());
switch (pset) {
case PS_SOFT:
break;
case PS_HARD:
break;
case PS_QUERY:
break;
case PS_QUERY_TYPE:
break;
default:
/*
* Must have the same UID as the target process or
* have PRIV_PROC_OWNER privilege.
*/
return (EPERM);
/*
* Unbinding of an unbound thread should always succeed.
*/
return (0);
/*
* Only privileged processes can move threads from psets with
* PSET_NOESCAPE attribute.
*/
secpolicy_pset(CRED()) != 0)
return (EPERM);
break;
}
return (error);
}
static int
void *zonebuf)
{
int error = 0;
/* skip kernel processes */
return (ENOTSUP);
}
do {
int rval;
zonebuf);
if (error == 0)
} else
return (error);
}
static int
void *zonebuf)
{
int error = 0;
return (ESRCH);
}
do {
int rval;
zonebuf);
if (error == 0)
}
return (error);
}
static int
{
int error = 0;
continue;
int rval;
zonebuf);
if (error == 0)
}
}
return (error);
}
static int
void *zonebuf)
{
int error = 0;
int rval;
zonebuf);
if (error == 0)
}
}
return (error);
}
/*
* Unbind all threads from the specified processor set, or from all
* processor sets.
*/
static int
{
int error = 0;
int rval;
return (EINVAL);
/*
* Skip zombies and kernel processes, and processes in
* other zones, if called from a non-global zone.
*/
continue;
}
do {
continue;
if (error == 0)
}
return (error);
}
static int
{
int error = 0;
int rval;
zonebuf);
if (error == 0)
}
}
return (error);
}
static int
{
contract_t *ct;
int error = 0;
pool_lock();
/*
* Check if the set actually exists before checking
* permissions. This is the historical error
* precedence. Note that if pset was PS_MYID, the
* cpupart_get_cpus call will change it to the
* processor set id of the caller (or PS_NONE if the
* caller is not bound to a processor set).
*/
if (pool_state == POOL_ENABLED) {
pool_unlock();
}
pool_unlock();
pool_unlock();
}
}
/*
* Pre-allocate enough buffers for FSS for all active projects
* and for all active zones on the system. Unused buffers will
* be freed later by fss_freebuf().
*/
switch (idtype) {
case P_LWPID:
} else {
break;
}
}
break;
case P_PID:
break;
}
break;
case P_TASKID:
break;
}
break;
case P_PROJID:
PROJECT_HOLD_FIND)) == NULL) {
break;
}
zonebuf);
break;
case P_ZONEID:
break;
}
break;
case P_CTID:
break;
}
zonebuf);
break;
case P_PSETID:
break;
}
break;
case P_ALL:
break;
}
break;
default:
break;
}
pool_unlock();
if (error != 0)
}
return (0);
}
/*
* Report load average statistics for the specified processor set.
*/
static int
{
int loadbuf[LOADAVG_NSTATS];
int error = 0;
if (nelem < 0)
/*
* We keep the same number of load average statistics for processor
* sets as we do for the system as a whole.
*/
if (nelem > LOADAVG_NSTATS)
if (error)
else
return (0);
}
/*
* Return list of active processor sets, up to a maximum indicated by
* numpsets. The total number of processor sets is stored in the
* location pointed to by numpsets.
*/
static int
{
uint_t user_npsets = 0;
int error = 0;
}
/*
* Get the list of all processor sets. First we need to find
* out how many there are, so we can allocate a large enough
* buffer.
*/
real_npsets = 0;
} else {
real_npsets = 1;
KM_SLEEP);
}
} else {
if (real_npsets) {
KM_SLEEP);
}
}
if (user_npsets > real_npsets)
user_npsets * sizeof (psetid_t)) != 0)
}
}
if (real_npsets)
if (error)
else
return (0);
}
static int
{
int error;
if (secpolicy_pset(CRED()) != 0)
pool_lock();
if (pool_state == POOL_ENABLED) {
pool_unlock();
}
pool_unlock();
}
pool_unlock();
}
pool_unlock();
return (0);
}
static int
{
int error = 0;
return (0);
}
static int
{
switch (subcode) {
case PSET_CREATE:
case PSET_DESTROY:
case PSET_ASSIGN:
case PSET_INFO:
case PSET_BIND:
case PSET_GETLOADAVG:
(int)arg3));
case PSET_LIST:
case PSET_SETATTR:
case PSET_GETATTR:
case PSET_ASSIGN_FORCED:
default:
}
}