xref: /illumos-gate/usr/src/cmd/dispadmin/dispadmin.h (revision dd72704bd9e794056c558153663c739e2012d721)
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 /*
32  *	Note that this file does not exist in the SVr4 base, but
33  *	is largely derived from sys/hrtcntl.h, hence the AT&T
34  *	copyright is propagated.  SVr4.0 1.9
35  */
36 
37 /*
38  * The following is an excerpt from <sys/hrtcntl.h>. HRT timers are not
39  * supported by SunOS (which will support the POSIX definition). Dispadmin
40  * uses the hrt routine _hrtnewres because it coincidentally does the
41  * right thing. These defines allow this routine to be locally included
42  * in dispadmin (rather than exported in libc). This should be improved in
43  * the long term.
44  */
45 
46 /*
47  *	Definitions for specifying rounding mode.
48  */
49 
50 #define	HRT_TRUNC	0	/* Round results down.	*/
51 #define	HRT_RND		1	/* Round results (rnd up if fractional	*/
52 				/*   part >= .5 otherwise round down).	*/
53 #define	HRT_RNDUP	2	/* Always round results up.	*/
54 
55 /*
56  *	Structure used to represent a high-resolution time-of-day
57  *	or interval.
58  */
59 
60 typedef struct hrtimer {
61 	ulong_t	hrt_secs;	/* Seconds.				*/
62 	long	hrt_rem;	/* A value less than a second.		*/
63 	ulong_t	hrt_res;	/* The resolution of hrt_rem.		*/
64 } hrtimer_t;
65 
66 /*
67  * Functions in subr.c
68  */
69 extern void fatalerr(const char *, ...);
70 extern long hrtconvert(hrtimer_t *);
71 extern int _hrtnewres(hrtimer_t *, ulong_t, long);
72