/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/priocntl.h>
#include <sys/fsspriocntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "dispadmin.h"
/*
* This file contains the class specific code implementing the fair-share
* scheduler dispadmin sub-command.
*/
extern char *basename();
"dispadmin -c FSS -g [-r res]\n"
"dispadmin -c FSS -s infile\n";
int
{
int c;
char *infile;
char *endp;
switch (c) {
case 'l':
lflag++;
break;
case 'c':
fatalerr("error: %s executed for %s class, "
"%s is actually sub-command for FSS "
break;
case 'g':
gflag++;
break;
case 'r':
rflag++;
errno = 0;
fatalerr("%s: Can't convert to requested "
"resolution\n", basenm);
break;
case 's':
sflag++;
break;
case '?':
default:
break;
}
}
if (lflag) {
(void) printf("FSS\t(Fair Share)\n");
return (0);
} else if (gflag) {
if (rflag == 0)
res = 1000;
return (0);
} else if (sflag) {
return (0);
} else {
}
return (1);
}
/*
* Retrieve the current settings from kernel, convert the time quantum
* value to the resolution specified by res and print out the results.
*/
static void
{
long fss_quantum;
fatalerr("%s: Can't get FSS class ID, priocntl system call "
fatalerr("%s: Can't get scheduler configuration, priocntl "
fatalerr("%s: Can't express time quantum in "
"requested resolution,\n"
"try coarser resolution\n", basenm);
(void) printf("#\n# Fair Share Scheduler Configuration\n#\n");
(void) printf("#\n# Time Quantum\n#\n");
}
/*
* Read the scheduler settings from infile, convert the time quantum values
* to HZ resolution, do a little sanity checking and overwrite kernel settings
* with the values from the file.
*/
static void
{
int i;
int line;
long fss_quantum;
char *endp;
int nparams = 0;
fatalerr("%s: Can't get FSS class ID, priocntl system call "
int len;
continue;
/*
* Look for "name=value", with optional whitespaces on either
* side, terminated by a newline, and consuming the whole line.
*/
/* LINTED - unbounded string specifier */
errno = 0;
i < 0 || *endp != '\0')
fatalerr("%s, line %d: illegal "
else
res = i;
nparams++;
errno = 0;
i < 0 || *endp != '\0')
fatalerr("%s, line %d: illegal time "
else
fss_quantum = i;
nparams++;
} else {
fatalerr("%s, line %d: invalid token\n",
}
} else {
}
}
fatalerr("%s: Can't convert specified "
"resolution to ticks\n", basenm);
fatalerr("%s, line %d: time quantum value out of "
} else {
}
fatalerr("%s: Can't set scheduler parameters, priocntl "
}