xref: /titanic_53/usr/src/uts/common/sys/priocntl.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
29*7c478bd9Sstevel@tonic-gate  */
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_PRIOCNTL_H
32*7c478bd9Sstevel@tonic-gate #define	_SYS_PRIOCNTL_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* from SVR4 1.6 */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/procset.h>
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
40*7c478bd9Sstevel@tonic-gate extern "C" {
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #define	PC_VERSION	1	/* First version of priocntl */
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
46*7c478bd9Sstevel@tonic-gate extern long	priocntl(idtype_t, id_t, int, ...);
47*7c478bd9Sstevel@tonic-gate extern long	priocntlset(procset_t *, int, ...);
48*7c478bd9Sstevel@tonic-gate #else
49*7c478bd9Sstevel@tonic-gate extern long	priocntl(), priocntlset();
50*7c478bd9Sstevel@tonic-gate #endif	/* __STDC__ */
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * The following are the possible values of the command
54*7c478bd9Sstevel@tonic-gate  * argument for the priocntl system call.
55*7c478bd9Sstevel@tonic-gate  */
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #define	PC_GETCID	0	/* Get class ID */
58*7c478bd9Sstevel@tonic-gate #define	PC_GETCLINFO	1	/* Get info about a configured class */
59*7c478bd9Sstevel@tonic-gate #define	PC_SETPARMS	2	/* Set scheduling parameters */
60*7c478bd9Sstevel@tonic-gate #define	PC_GETPARMS	3	/* Get scheduling parameters */
61*7c478bd9Sstevel@tonic-gate #define	PC_ADMIN	4	/* Scheduler administration (used by */
62*7c478bd9Sstevel@tonic-gate 				/*   dispadmin(1M), not for general use) */
63*7c478bd9Sstevel@tonic-gate #define	PC_GETPRIRANGE	5	/* Get global priority range for a class */
64*7c478bd9Sstevel@tonic-gate 				/* posix.4 scheduling, not for general use */
65*7c478bd9Sstevel@tonic-gate #define	PC_DONICE	6	/* Set or get nice value */
66*7c478bd9Sstevel@tonic-gate #define	PC_SETXPARMS	7	/* Set extended scheduling parameters */
67*7c478bd9Sstevel@tonic-gate #define	PC_GETXPARMS	8	/* Get extended scheduling parameters */
68*7c478bd9Sstevel@tonic-gate #define	PC_SETDFLCL	9	/* Set default class, not for general use */
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate #define	PC_CLNULL	-1
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate #define	PC_CLNMSZ	16
73*7c478bd9Sstevel@tonic-gate #define	PC_CLINFOSZ	(32 / sizeof (int))
74*7c478bd9Sstevel@tonic-gate #define	PC_CLPARMSZ	(32 / sizeof (int))
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate #define	PC_GETNICE	0
77*7c478bd9Sstevel@tonic-gate #define	PC_SETNICE	1
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate typedef struct pcinfo {
80*7c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* class id */
81*7c478bd9Sstevel@tonic-gate 	char	pc_clname[PC_CLNMSZ];	/* class name */
82*7c478bd9Sstevel@tonic-gate 	int	pc_clinfo[PC_CLINFOSZ];	/* class information */
83*7c478bd9Sstevel@tonic-gate } pcinfo_t;
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate typedef struct pcparms {
86*7c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			    /* process class */
87*7c478bd9Sstevel@tonic-gate 	int	pc_clparms[PC_CLPARMSZ];    /* class specific parameters */
88*7c478bd9Sstevel@tonic-gate } pcparms_t;
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate typedef struct pcnice {
91*7c478bd9Sstevel@tonic-gate 	int	pc_val;			/* nice value */
92*7c478bd9Sstevel@tonic-gate 	int	pc_op;			/* type of operation, set or get */
93*7c478bd9Sstevel@tonic-gate } pcnice_t;
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate /*
96*7c478bd9Sstevel@tonic-gate  * The following is used by the priocntl(2) varargs interface (command
97*7c478bd9Sstevel@tonic-gate  * codes: PC_SETXPARMS and PC_GETXPARMS).
98*7c478bd9Sstevel@tonic-gate  */
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate #define	PC_VAPARMCNT	8	/* maximal number of (key, value) pairs */
101*7c478bd9Sstevel@tonic-gate #define	PC_KY_NULL	0	/* terminates the (key, value) pair chain */
102*7c478bd9Sstevel@tonic-gate #define	PC_KY_CLNAME	1	/* get the class name of a process or LWP. */
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate typedef	struct pc_vaparm {
105*7c478bd9Sstevel@tonic-gate 	int		pc_key;		/* describing key */
106*7c478bd9Sstevel@tonic-gate 	u_longlong_t	pc_parm;	/* associated parameter */
107*7c478bd9Sstevel@tonic-gate } pc_vaparm_t;
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate typedef	struct pc_vaparms {
110*7c478bd9Sstevel@tonic-gate 	uint_t		pc_vaparmscnt;		/* # of (key, value) pairs */
111*7c478bd9Sstevel@tonic-gate 	pc_vaparm_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
112*7c478bd9Sstevel@tonic-gate } pc_vaparms_t;
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) && \
115*7c478bd9Sstevel@tonic-gate 	_LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate /*
118*7c478bd9Sstevel@tonic-gate  * These structures are needed by the 64-bit kernel on certain architectures
119*7c478bd9Sstevel@tonic-gate  * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland.
120*7c478bd9Sstevel@tonic-gate  */
121*7c478bd9Sstevel@tonic-gate #pragma pack(4)
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate typedef struct {
124*7c478bd9Sstevel@tonic-gate 	int32_t		pc_key;		/* describing key */
125*7c478bd9Sstevel@tonic-gate 	uint64_t	pc_parm;	/* associated parameter */
126*7c478bd9Sstevel@tonic-gate } pc_vaparm32_t;
127*7c478bd9Sstevel@tonic-gate 
128*7c478bd9Sstevel@tonic-gate #pragma pack()
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate typedef struct {
131*7c478bd9Sstevel@tonic-gate 	uint32_t	pc_vaparmscnt;		/* # of (key, value) pairs */
132*7c478bd9Sstevel@tonic-gate 	pc_vaparm32_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
133*7c478bd9Sstevel@tonic-gate } pc_vaparms32_t;
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 && ... */
136*7c478bd9Sstevel@tonic-gate 
137*7c478bd9Sstevel@tonic-gate /*
138*7c478bd9Sstevel@tonic-gate  * The following is used by the library librt for
139*7c478bd9Sstevel@tonic-gate  * posix.4 scheduler interfaces and is not for general use.
140*7c478bd9Sstevel@tonic-gate  */
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate typedef struct pcpri {
143*7c478bd9Sstevel@tonic-gate 	id_t	pc_cid;			/* process class */
144*7c478bd9Sstevel@tonic-gate 	pri_t	pc_clpmax;		/* class global priority max */
145*7c478bd9Sstevel@tonic-gate 	pri_t	pc_clpmin;		/* class global priority min */
146*7c478bd9Sstevel@tonic-gate } pcpri_t;
147*7c478bd9Sstevel@tonic-gate 
148*7c478bd9Sstevel@tonic-gate /*
149*7c478bd9Sstevel@tonic-gate  * The following is used by the dispadmin(1M) command for
150*7c478bd9Sstevel@tonic-gate  * scheduler administration and is not for general use.
151*7c478bd9Sstevel@tonic-gate  */
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
154*7c478bd9Sstevel@tonic-gate /* Data structure for ILP32 clients */
155*7c478bd9Sstevel@tonic-gate typedef struct pcadmin32 {
156*7c478bd9Sstevel@tonic-gate 	id32_t		pc_cid;
157*7c478bd9Sstevel@tonic-gate 	caddr32_t	pc_cladmin;
158*7c478bd9Sstevel@tonic-gate } pcadmin32_t;
159*7c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
160*7c478bd9Sstevel@tonic-gate 
161*7c478bd9Sstevel@tonic-gate typedef struct pcadmin {
162*7c478bd9Sstevel@tonic-gate 	id_t	pc_cid;
163*7c478bd9Sstevel@tonic-gate 	caddr_t	pc_cladmin;
164*7c478bd9Sstevel@tonic-gate } pcadmin_t;
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
167*7c478bd9Sstevel@tonic-gate }
168*7c478bd9Sstevel@tonic-gate #endif
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_PRIOCNTL_H */
171