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