/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "lint.h"
#include "thr_uberdata.h"
#include <sched.h>
#include <sys/tspriocntl.h>
#include <sys/rtpriocntl.h>
#include <sys/fxpriocntl.h>
/*
* The following array is used for caching information
* for priocntl scheduling classes.
*/
{0, SCHED_SYS, 0, 0, {0, "SYS", 0}},
/*
* Allow unknown (to us) scheduling classes.
* The kernel allows space for exactly 10 scheduling classes
* (see the definitions of 'sclass' and 'nclass' in the kernel).
* We need that number of available slots here.
* If the kernel space is changed, this has to change too.
*/
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
{0, -1, 0, 0, {-1, "", 0}},
};
#error "fatal: _SCHED_NEXT != SCHED_FX + 1"
#endif
/*
* Helper function for get_info_by_policy(), below.
* Don't let a manufactured policy number duplicate
* the class of one of our base policy numbers.
*/
static int
{
int policy;
return (1);
}
return (0);
}
/*
* Cache priocntl information on scheduling class by policy.
*/
const pcclass_t *
{
int base = 0;
return (NULL);
}
return (pccp);
/* get class info (the system class is known to have class-id == 0) */
/* policy number not defined in <sched.h> */
/*
* If we duplicated a base class, permanently
* disable this policy entry. Else allow for
* dynamic loading of scheduling classes.
*/
if (base) {
}
return (NULL);
}
return (NULL);
}
switch (policy) {
case SCHED_OTHER:
break;
case SCHED_FIFO:
case SCHED_RR:
pccp->pcc_primin = 0;
break;
default:
/*
* All other policy numbers, including policy numbers
* not defined in <sched.h>.
*/
}
break;
}
return (pccp);
}
const pcclass_t *
{
int policy;
if (classid < 0) {
return (NULL);
}
/* determine if we already know this classid */
return (pccp);
}
if (classid == 0) /* no kernel info for sys class */
return (get_info_by_policy(SCHED_SYS));
return (NULL);
}
}
/*
* We have encountered an unknown (to us) scheduling class.
* Manufacture a policy number for it. Hopefully we still
* have room in the sched_class[] table.
*/
return (NULL);
}
}
/*
* Helper function: get process or lwp current scheduling policy.
*/
static const pcclass_t *
{
return (NULL);
}
/*
* Helper function for setprio() and setparam(), below.
*/
static int
{
int rv;
switch (policy) {
case SCHED_OTHER:
{
break;
}
case SCHED_FIFO:
case SCHED_RR:
{
break;
}
default:
{
/*
* Class-independent method for setting the priority.
*/
do {
return (rv);
}
}
do {
return (rv);
}
/*
* Utility function, private to libc, used by sched_setparam()
* and posix_spawn(). Because it is called by the vfork() child of
* posix_spawn(), we must not call any functions exported from libc.
*/
{
int policy;
return (-1);
return (-1);
}
}
return (-1);
}
int
{
if (pid < 0) {
return (-1);
}
if (pid == 0)
return (-1);
return (0);
}
{
int policy;
int priority;
return (-1);
case SCHED_OTHER:
{
break;
}
case SCHED_FIFO:
case SCHED_RR:
{
break;
}
default:
{
/*
* Class-independent method for getting the priority.
*/
else
priority = 0;
break;
}
}
}
int
{
int policy;
if (pid < 0) {
return (-1);
}
if (pid == 0)
return (-1);
return (0);
}
/*
* Utility function, private to libc, used by sched_setscheduler()
* and posix_spawn(). Because it is called by the vfork() child of
* posix_spawn(), we must not call any functions exported from libc.
*/
{
return (-1);
}
return (-1);
}
int
{
int oldpolicy;
return (-1);
if (pid == 0)
return (-1);
return (oldpolicy);
}
int
{
int policy;
if (pid < 0) {
return (-1);
}
if (pid == 0)
return (-1);
policy =
SCHED_FIFO : SCHED_RR);
}
return (policy);
}
int
sched_yield(void)
{
yield();
return (0);
}
int
{
return (pccp->pcc_primax);
return (-1);
}
int
{
return (pccp->pcc_primin);
return (-1);
}
int
{
if (pid < 0) {
return (-1);
}
if (pid == 0)
return (-1);
/*
* At the moment, we have no class-independent method to fetch
* this operation to the real-time class, we return an indefinite
* quantum (tv_sec == 0 and tv_nsec == 0) for scheduling policies
* for which this information isn't available.
*/
switch (pccp->pcc_policy) {
case SCHED_FIFO:
case SCHED_RR:
{
}
}
break;
case SCHED_FX:
{
}
}
break;
}
return (0);
}
/*
* Initialize or update ul_policy, ul_cid, and ul_pri.
*/
void
{
int priority;
int policy;
}
return;
}
return;
}
return;
}
case SCHED_OTHER:
break;
case SCHED_FIFO:
case SCHED_RR:
policy =
break;
default:
/*
* Class-independent method for getting the priority.
*/
else
priority = 0;
}
}