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