Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/cmd/rcap/common/utils.h
+++ new/usr/src/cmd/rcap/common/utils.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright (c) 2011, Joyent, Inc. All rights reserved.
25 25 */
26 26
27 27 #ifndef _UTILS_H
28 28 #define _UTILS_H
29 29
30 30 #include <assert.h>
31 31 #include <libintl.h>
32 32 #include <stdarg.h>
33 33 #include <time.h>
34 34 #include <libzonecfg.h>
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 #define E_SUCCESS 0 /* Exit status for success */
41 41 #define E_ERROR 1 /* Exit status for error */
42 42 #define E_USAGE 2 /* Exit status for usage error */
43 43
44 44 /*
45 45 * Message filter levels by priority
46 46 */
47 47 typedef enum rcm_level {
48 48 RCM_NONE = 0, /* No messages */
49 49 RCM_ERR, /* Errors only */
50 50 RCM_WARN, /* Warnings */
51 51 RCM_INFO, /* Information */
52 52 RCM_DEBUG, /* Everything */
53 53 RCM_DEBUG_HIGH /* Fire hose */
54 54 } rcm_level_t;
55 55
56 56 /*
57 57 * Message destinations
58 58 */
59 59 typedef enum rcm_dst {
60 60 RCD_STD = 1, /* Standard output/error, depending */
61 61 /* on level */
62 62 RCD_SYSLOG /* syslog() daemon facility */
63 63 } rcm_dst_t;
64 64
65 65 typedef struct zone_entry {
66 66 zoneid_t zid;
67 67 char zname[ZONENAME_MAX];
68 68 } zone_entry_t;
69 69
70 70 #define LINELEN 256 /* max. message length */
71 71
72 72 #ifdef DEBUG
73 73 #undef ASSERT
74 74 #define ASSERT(x) (assert(x))
75 75 #else /* !DEBUG */
76 76 #undef ASSERT
77 77 #define ASSERT(x) ((void)0)
78 78 #endif /* DEBUG */
79 79
80 80 #ifdef DEBUG_MSG
81 81 extern void debug(char *, ...);
82 82 extern void debug_high(char *, ...);
83 83 #else /* !DEBUG_MSG */
84 84 /*LINTED: static unused*/
85 85 static void debug(char *format, ...) /*ARGSUSED*/ {}
86 86 /*LINTED: static unused*/
87 87 static void debug_high(char *format, ...) /*ARGSUSED*/ {}
88 88 #endif /* DEBUG_MSG */
89 89
90 90 extern void die(char *, ...);
91 91 extern void info(char *, ...);
92 92 extern rcm_level_t get_message_priority(void);
93 93 extern rcm_level_t set_message_priority(rcm_level_t);
94 94 extern rcm_dst_t set_message_destination(rcm_dst_t);
95 95 extern char *setpname(char *);
96 96 extern void warn(const char *, ...);
97 97 extern int valid_abspath(char *);
98 98 extern void vdprintfe(int, const char *, va_list);
99 99 extern void dprintfe(int, char *, ...);
100 100 extern void hrt2ts(hrtime_t, timestruc_t *);
101 101 extern int xatoi(char *);
102 102
103 103 #ifdef __cplusplus
104 104 }
105 105 #endif
106 106
107 107 #endif /* _UTILS_H */
|
↓ open down ↓ |
107 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX