xref: /titanic_44/usr/src/uts/common/sys/priocntl.h (revision d4204c85a44d2589b9afff2c81db7044e97f2d1d)
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
5f841f6adSraf  * Common Development and Distribution License (the "License").
6f841f6adSraf  * 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  */
21f841f6adSraf 
227c478bd9Sstevel@tonic-gate /*
23*d4204c85Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
27*d4204c85Sraf /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*d4204c85Sraf /*	  All Rights Reserved  	*/
29*d4204c85Sraf 
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) */
62*d4204c85Sraf #define	PC_GETPRIRANGE	5	/* Get 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 */
680209230bSgjelinek #define	PC_GETDFLCL	10	/* Get default class, not for general use */
69*d4204c85Sraf #define	PC_DOPRIO	11	/* Set or get priority, not for general use */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define	PC_CLNULL	-1
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate #define	PC_CLNMSZ	16
747c478bd9Sstevel@tonic-gate #define	PC_CLINFOSZ	(32 / sizeof (int))
757c478bd9Sstevel@tonic-gate #define	PC_CLPARMSZ	(32 / sizeof (int))
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate #define	PC_GETNICE	0
787c478bd9Sstevel@tonic-gate #define	PC_SETNICE	1
797c478bd9Sstevel@tonic-gate 
80*d4204c85Sraf #define	PC_GETPRIO	0
81*d4204c85Sraf #define	PC_SETPRIO	1
82*d4204c85Sraf 
837c478bd9Sstevel@tonic-gate typedef struct pcinfo {
847c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* class id */
857c478bd9Sstevel@tonic-gate 	char	pc_clname[PC_CLNMSZ];	/* class name */
867c478bd9Sstevel@tonic-gate 	int	pc_clinfo[PC_CLINFOSZ];	/* class information */
877c478bd9Sstevel@tonic-gate } pcinfo_t;
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate typedef struct pcparms {
907c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			    /* process class */
917c478bd9Sstevel@tonic-gate 	int	pc_clparms[PC_CLPARMSZ];    /* class specific parameters */
927c478bd9Sstevel@tonic-gate } pcparms_t;
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate typedef struct pcnice {
957c478bd9Sstevel@tonic-gate 	int	pc_val;			/* nice value */
967c478bd9Sstevel@tonic-gate 	int	pc_op;			/* type of operation, set or get */
977c478bd9Sstevel@tonic-gate } pcnice_t;
987c478bd9Sstevel@tonic-gate 
99*d4204c85Sraf typedef struct pcprio {
100*d4204c85Sraf 	int	pc_op;			/* type of operation, set or get */
101*d4204c85Sraf 	id_t	pc_cid;			/* class id */
102*d4204c85Sraf 	int	pc_val;			/* priority value */
103*d4204c85Sraf } pcprio_t;
104*d4204c85Sraf 
1057c478bd9Sstevel@tonic-gate /*
1067c478bd9Sstevel@tonic-gate  * The following is used by the priocntl(2) varargs interface (command
1077c478bd9Sstevel@tonic-gate  * codes: PC_SETXPARMS and PC_GETXPARMS).
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #define	PC_VAPARMCNT	8	/* maximal number of (key, value) pairs */
1117c478bd9Sstevel@tonic-gate #define	PC_KY_NULL	0	/* terminates the (key, value) pair chain */
1127c478bd9Sstevel@tonic-gate #define	PC_KY_CLNAME	1	/* get the class name of a process or LWP. */
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate typedef	struct pc_vaparm {
1157c478bd9Sstevel@tonic-gate 	int		pc_key;		/* describing key */
1167c478bd9Sstevel@tonic-gate 	u_longlong_t	pc_parm;	/* associated parameter */
1177c478bd9Sstevel@tonic-gate } pc_vaparm_t;
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate typedef	struct pc_vaparms {
1207c478bd9Sstevel@tonic-gate 	uint_t		pc_vaparmscnt;		/* # of (key, value) pairs */
1217c478bd9Sstevel@tonic-gate 	pc_vaparm_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
1227c478bd9Sstevel@tonic-gate } pc_vaparms_t;
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) && \
1257c478bd9Sstevel@tonic-gate 	_LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /*
1287c478bd9Sstevel@tonic-gate  * These structures are needed by the 64-bit kernel on certain architectures
1297c478bd9Sstevel@tonic-gate  * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland.
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate #pragma pack(4)
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate typedef struct {
1347c478bd9Sstevel@tonic-gate 	int32_t		pc_key;		/* describing key */
1357c478bd9Sstevel@tonic-gate 	uint64_t	pc_parm;	/* associated parameter */
1367c478bd9Sstevel@tonic-gate } pc_vaparm32_t;
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate #pragma pack()
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate typedef struct {
1417c478bd9Sstevel@tonic-gate 	uint32_t	pc_vaparmscnt;		/* # of (key, value) pairs */
1427c478bd9Sstevel@tonic-gate 	pc_vaparm32_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
1437c478bd9Sstevel@tonic-gate } pc_vaparms32_t;
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 && ... */
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
148f841f6adSraf  * The following is used by libc for posix.4
149f841f6adSraf  * scheduler interfaces and is not for general use.
1507c478bd9Sstevel@tonic-gate  */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate typedef struct pcpri {
1537c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* process class */
154*d4204c85Sraf 	pri_t	pc_clpmax;		/* class priority max */
155*d4204c85Sraf 	pri_t	pc_clpmin;		/* class priority min */
1567c478bd9Sstevel@tonic-gate } pcpri_t;
1577c478bd9Sstevel@tonic-gate 
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate  * The following is used by the dispadmin(1M) command for
1607c478bd9Sstevel@tonic-gate  * scheduler administration and is not for general use.
1617c478bd9Sstevel@tonic-gate  */
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
1647c478bd9Sstevel@tonic-gate /* Data structure for ILP32 clients */
1657c478bd9Sstevel@tonic-gate typedef struct pcadmin32 {
1667c478bd9Sstevel@tonic-gate 	id32_t		pc_cid;
1677c478bd9Sstevel@tonic-gate 	caddr32_t	pc_cladmin;
1687c478bd9Sstevel@tonic-gate } pcadmin32_t;
1697c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate typedef struct pcadmin {
1727c478bd9Sstevel@tonic-gate 	id_t	pc_cid;
1737c478bd9Sstevel@tonic-gate 	caddr_t	pc_cladmin;
1747c478bd9Sstevel@tonic-gate } pcadmin_t;
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1777c478bd9Sstevel@tonic-gate }
1787c478bd9Sstevel@tonic-gate #endif
1797c478bd9Sstevel@tonic-gate 
1807c478bd9Sstevel@tonic-gate #endif	/* _SYS_PRIOCNTL_H */
181