xref: /titanic_50/usr/src/uts/common/sys/priocntl.h (revision f841f6ad96ea6675d6c6b35c749eaac601799fdf)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*f841f6adSraf  * Common Development and Distribution License (the "License").
6*f841f6adSraf  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*f841f6adSraf 
227c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
237c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
247c478bd9Sstevel@tonic-gate 
257c478bd9Sstevel@tonic-gate /*
26*f841f6adSraf  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_PRIOCNTL_H
317c478bd9Sstevel@tonic-gate #define	_SYS_PRIOCNTL_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* from SVR4 1.6 */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate #include <sys/procset.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #define	PC_VERSION	1	/* First version of priocntl */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #ifdef __STDC__
457c478bd9Sstevel@tonic-gate extern long	priocntl(idtype_t, id_t, int, ...);
467c478bd9Sstevel@tonic-gate extern long	priocntlset(procset_t *, int, ...);
477c478bd9Sstevel@tonic-gate #else
487c478bd9Sstevel@tonic-gate extern long	priocntl(), priocntlset();
497c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * The following are the possible values of the command
537c478bd9Sstevel@tonic-gate  * argument for the priocntl system call.
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	PC_GETCID	0	/* Get class ID */
577c478bd9Sstevel@tonic-gate #define	PC_GETCLINFO	1	/* Get info about a configured class */
587c478bd9Sstevel@tonic-gate #define	PC_SETPARMS	2	/* Set scheduling parameters */
597c478bd9Sstevel@tonic-gate #define	PC_GETPARMS	3	/* Get scheduling parameters */
607c478bd9Sstevel@tonic-gate #define	PC_ADMIN	4	/* Scheduler administration (used by */
617c478bd9Sstevel@tonic-gate 				/*   dispadmin(1M), not for general use) */
627c478bd9Sstevel@tonic-gate #define	PC_GETPRIRANGE	5	/* Get global priority range for a class */
637c478bd9Sstevel@tonic-gate 				/* posix.4 scheduling, not for general use */
647c478bd9Sstevel@tonic-gate #define	PC_DONICE	6	/* Set or get nice value */
657c478bd9Sstevel@tonic-gate #define	PC_SETXPARMS	7	/* Set extended scheduling parameters */
667c478bd9Sstevel@tonic-gate #define	PC_GETXPARMS	8	/* Get extended scheduling parameters */
677c478bd9Sstevel@tonic-gate #define	PC_SETDFLCL	9	/* Set default class, not for general use */
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate #define	PC_CLNULL	-1
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define	PC_CLNMSZ	16
727c478bd9Sstevel@tonic-gate #define	PC_CLINFOSZ	(32 / sizeof (int))
737c478bd9Sstevel@tonic-gate #define	PC_CLPARMSZ	(32 / sizeof (int))
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #define	PC_GETNICE	0
767c478bd9Sstevel@tonic-gate #define	PC_SETNICE	1
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate typedef struct pcinfo {
797c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* class id */
807c478bd9Sstevel@tonic-gate 	char	pc_clname[PC_CLNMSZ];	/* class name */
817c478bd9Sstevel@tonic-gate 	int	pc_clinfo[PC_CLINFOSZ];	/* class information */
827c478bd9Sstevel@tonic-gate } pcinfo_t;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate typedef struct pcparms {
857c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			    /* process class */
867c478bd9Sstevel@tonic-gate 	int	pc_clparms[PC_CLPARMSZ];    /* class specific parameters */
877c478bd9Sstevel@tonic-gate } pcparms_t;
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate typedef struct pcnice {
907c478bd9Sstevel@tonic-gate 	int	pc_val;			/* nice value */
917c478bd9Sstevel@tonic-gate 	int	pc_op;			/* type of operation, set or get */
927c478bd9Sstevel@tonic-gate } pcnice_t;
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate  * The following is used by the priocntl(2) varargs interface (command
967c478bd9Sstevel@tonic-gate  * codes: PC_SETXPARMS and PC_GETXPARMS).
977c478bd9Sstevel@tonic-gate  */
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #define	PC_VAPARMCNT	8	/* maximal number of (key, value) pairs */
1007c478bd9Sstevel@tonic-gate #define	PC_KY_NULL	0	/* terminates the (key, value) pair chain */
1017c478bd9Sstevel@tonic-gate #define	PC_KY_CLNAME	1	/* get the class name of a process or LWP. */
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate typedef	struct pc_vaparm {
1047c478bd9Sstevel@tonic-gate 	int		pc_key;		/* describing key */
1057c478bd9Sstevel@tonic-gate 	u_longlong_t	pc_parm;	/* associated parameter */
1067c478bd9Sstevel@tonic-gate } pc_vaparm_t;
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate typedef	struct pc_vaparms {
1097c478bd9Sstevel@tonic-gate 	uint_t		pc_vaparmscnt;		/* # of (key, value) pairs */
1107c478bd9Sstevel@tonic-gate 	pc_vaparm_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
1117c478bd9Sstevel@tonic-gate } pc_vaparms_t;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) && \
1147c478bd9Sstevel@tonic-gate 	_LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * These structures are needed by the 64-bit kernel on certain architectures
1187c478bd9Sstevel@tonic-gate  * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland.
1197c478bd9Sstevel@tonic-gate  */
1207c478bd9Sstevel@tonic-gate #pragma pack(4)
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate typedef struct {
1237c478bd9Sstevel@tonic-gate 	int32_t		pc_key;		/* describing key */
1247c478bd9Sstevel@tonic-gate 	uint64_t	pc_parm;	/* associated parameter */
1257c478bd9Sstevel@tonic-gate } pc_vaparm32_t;
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #pragma pack()
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate typedef struct {
1307c478bd9Sstevel@tonic-gate 	uint32_t	pc_vaparmscnt;		/* # of (key, value) pairs */
1317c478bd9Sstevel@tonic-gate 	pc_vaparm32_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
1327c478bd9Sstevel@tonic-gate } pc_vaparms32_t;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 && ... */
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /*
137*f841f6adSraf  * The following is used by libc for posix.4
138*f841f6adSraf  * scheduler interfaces and is not for general use.
1397c478bd9Sstevel@tonic-gate  */
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate typedef struct pcpri {
1427c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* process class */
1437c478bd9Sstevel@tonic-gate 	pri_t	pc_clpmax;		/* class global priority max */
1447c478bd9Sstevel@tonic-gate 	pri_t	pc_clpmin;		/* class global priority min */
1457c478bd9Sstevel@tonic-gate } pcpri_t;
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * The following is used by the dispadmin(1M) command for
1497c478bd9Sstevel@tonic-gate  * scheduler administration and is not for general use.
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
1537c478bd9Sstevel@tonic-gate /* Data structure for ILP32 clients */
1547c478bd9Sstevel@tonic-gate typedef struct pcadmin32 {
1557c478bd9Sstevel@tonic-gate 	id32_t		pc_cid;
1567c478bd9Sstevel@tonic-gate 	caddr32_t	pc_cladmin;
1577c478bd9Sstevel@tonic-gate } pcadmin32_t;
1587c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate typedef struct pcadmin {
1617c478bd9Sstevel@tonic-gate 	id_t	pc_cid;
1627c478bd9Sstevel@tonic-gate 	caddr_t	pc_cladmin;
1637c478bd9Sstevel@tonic-gate } pcadmin_t;
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1667c478bd9Sstevel@tonic-gate }
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #endif	/* _SYS_PRIOCNTL_H */
170