summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/priocntl.h
blob: 6475ed0a4c6a5b135379143b12d1aee1fccea792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
/*	  All Rights Reserved  	*/

/*
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _SYS_PRIOCNTL_H
#define	_SYS_PRIOCNTL_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"	/* from SVR4 1.6 */

#include <sys/types.h>
#include <sys/procset.h>

#ifdef	__cplusplus
extern "C" {
#endif

#define	PC_VERSION	1	/* First version of priocntl */

#ifdef __STDC__
extern long	priocntl(idtype_t, id_t, int, ...);
extern long	priocntlset(procset_t *, int, ...);
#else
extern long	priocntl(), priocntlset();
#endif	/* __STDC__ */

/*
 * The following are the possible values of the command
 * argument for the priocntl system call.
 */

#define	PC_GETCID	0	/* Get class ID */
#define	PC_GETCLINFO	1	/* Get info about a configured class */
#define	PC_SETPARMS	2	/* Set scheduling parameters */
#define	PC_GETPARMS	3	/* Get scheduling parameters */
#define	PC_ADMIN	4	/* Scheduler administration (used by */
				/*   dispadmin(1M), not for general use) */
#define	PC_GETPRIRANGE	5	/* Get global priority range for a class */
				/* posix.4 scheduling, not for general use */
#define	PC_DONICE	6	/* Set or get nice value */
#define	PC_SETXPARMS	7	/* Set extended scheduling parameters */
#define	PC_GETXPARMS	8	/* Get extended scheduling parameters */
#define	PC_SETDFLCL	9	/* Set default class, not for general use */
#define	PC_GETDFLCL	10	/* Get default class, not for general use */

#define	PC_CLNULL	-1

#define	PC_CLNMSZ	16
#define	PC_CLINFOSZ	(32 / sizeof (int))
#define	PC_CLPARMSZ	(32 / sizeof (int))

#define	PC_GETNICE	0
#define	PC_SETNICE	1

typedef struct pcinfo {
	id_t	pc_cid;			/* class id */
	char	pc_clname[PC_CLNMSZ];	/* class name */
	int	pc_clinfo[PC_CLINFOSZ];	/* class information */
} pcinfo_t;

typedef struct pcparms {
	id_t	pc_cid;			    /* process class */
	int	pc_clparms[PC_CLPARMSZ];    /* class specific parameters */
} pcparms_t;

typedef struct pcnice {
	int	pc_val;			/* nice value */
	int	pc_op;			/* type of operation, set or get */
} pcnice_t;

/*
 * The following is used by the priocntl(2) varargs interface (command
 * codes: PC_SETXPARMS and PC_GETXPARMS).
 */

#define	PC_VAPARMCNT	8	/* maximal number of (key, value) pairs */
#define	PC_KY_NULL	0	/* terminates the (key, value) pair chain */
#define	PC_KY_CLNAME	1	/* get the class name of a process or LWP. */

typedef	struct pc_vaparm {
	int		pc_key;		/* describing key */
	u_longlong_t	pc_parm;	/* associated parameter */
} pc_vaparm_t;

typedef	struct pc_vaparms {
	uint_t		pc_vaparmscnt;		/* # of (key, value) pairs */
	pc_vaparm_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
} pc_vaparms_t;

#if defined(_SYSCALL32) && \
	_LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4

/*
 * These structures are needed by the 64-bit kernel on certain architectures
 * to translate pc_vaparms_t/pc_vaparm_t data structures from 32-bit userland.
 */
#pragma pack(4)

typedef struct {
	int32_t		pc_key;		/* describing key */
	uint64_t	pc_parm;	/* associated parameter */
} pc_vaparm32_t;

#pragma pack()

typedef struct {
	uint32_t	pc_vaparmscnt;		/* # of (key, value) pairs */
	pc_vaparm32_t	pc_parms[PC_VAPARMCNT];	/* parameter buffer */
} pc_vaparms32_t;

#endif	/* _SYSCALL32 && ... */

/*
 * The following is used by libc for posix.4
 * scheduler interfaces and is not for general use.
 */

typedef struct pcpri {
	id_t	pc_cid;			/* process class */
	pri_t	pc_clpmax;		/* class global priority max */
	pri_t	pc_clpmin;		/* class global priority min */
} pcpri_t;

/*
 * The following is used by the dispadmin(1M) command for
 * scheduler administration and is not for general use.
 */

#ifdef _SYSCALL32
/* Data structure for ILP32 clients */
typedef struct pcadmin32 {
	id32_t		pc_cid;
	caddr32_t	pc_cladmin;
} pcadmin32_t;
#endif	/* _SYSCALL32 */

typedef struct pcadmin {
	id_t	pc_cid;
	caddr_t	pc_cladmin;
} pcadmin_t;

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_PRIOCNTL_H */