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