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