xref: /illumos-gate/usr/src/cmd/priocntl/priocntl.h (revision 00242527)
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 2001-2002 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 
32 #ifndef	_PRIOCNTL_H
33 #define	_PRIOCNTL_H
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	NPIDS	1024	/* number of additional pids allocated by realloc(). */
40 #define	NIDS	1024	/* max number of id arguments we handle */
41 
42 #define	BASENMSZ	16
43 #define	CSOPTSLN	128	/* max length of class specific opts string */
44 #define	PC_IDTYPNMSZ	12	/* max length of an idtype name */
45 
46 /*
47  * The command string for the sub-command must be big enough for the
48  * path, the class specific options, and plenty of space for arguments.
49  */
50 #define	SUBCMDSZ	512
51 
52 #define	BADPID	(-2)
53 
54 extern void	fatalerr();
55 extern int	str2idtyp(char *, idtype_t *);
56 extern int	idtyp2str(idtype_t, char *);
57 extern int	idcompar(id_t *, id_t *);
58 extern id_t	clname2cid(char *);
59 extern int	getmyid(idtype_t, id_t *);
60 extern int	getmyidstr(idtype_t, char *);
61 extern int	verifyupri(idtype_t, id_t, char *, int, pri_t, char *);
62 extern pid_t	*read_pidlist(size_t *, FILE *);
63 extern void	free_pidlist(pid_t *);
64 extern long	str2num(char *, long, long);
65 extern void	itoa(long, char *);
66 
67 /*
68  * The following is an excerpt from <sys/hrtcntl.h>. HRT timers are not
69  * supported by SunOS (which will support the POSIX definition). Priocntl
70  * uses the hrt routine _hrtnewres because it coincidentally does the
71  * right thing. These defines allow this routine to be locally included
72  * in priocntl (rather than exported in libc). This should be improved in
73  * the long term.
74  */
75 
76 #define	HRT_TRUNC	0	/* Round results down.	*/
77 #define	HRT_RND		1	/* Round results (rnd up if fractional	*/
78 				/*   part >= .5 otherwise round down).	*/
79 #define	HRT_RNDUP	2	/* Always round results up.	*/
80 
81 /*
82  *	Structure used to represent a high-resolution time-of-day
83  *	or interval.
84  */
85 
86 typedef struct hrtimer {
87 	ulong_t	hrt_secs;	/* Seconds.				*/
88 	long	hrt_rem;	/* A value less than a second.		*/
89 	ulong_t	hrt_res;	/* The resolution of hrt_rem.		*/
90 } hrtimer_t;
91 
92 extern int	_hrtnewres(hrtimer_t *, ulong_t, long);
93 
94 #ifdef	__cplusplus
95 }
96 #endif
97 
98 #endif	/* _PRIOCNTL_H */
99