Print this page
4477 DTrace should speak JSON
Reviewed by: Bryan Cantrill <bmc@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/common/util/strtolctype.h
+++ new/usr/src/common/util/strtolctype.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 2009 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26
27 27 /* Copyright (c) 1988 AT&T */
28 28 /* All Rights Reserved */
29 29
30 30 #ifndef _COMMON_UTIL_CTYPE_H
↓ open down ↓ |
30 lines elided |
↑ open up ↑ |
31 31 #define _COMMON_UTIL_CTYPE_H
32 32
33 33 #ifdef __cplusplus
34 34 extern "C" {
35 35 #endif
36 36
37 37 /*
38 38 * This header file contains a collection of macros that the strtou?ll?
39 39 * functions in common/util use to test characters. What we need is a kernel
40 40 * version of ctype.h.
41 + *
42 + * NOTE: These macros are used within several DTrace probe context functions.
43 + * They must not be altered to make function calls or perform actions not
44 + * safe in probe context.
41 45 */
42 46
43 47 #if defined(_KERNEL) && !defined(_BOOT)
44 48
45 49 #define isalnum(ch) (isalpha(ch) || isdigit(ch))
46 50 #define isalpha(ch) (isupper(ch) || islower(ch))
47 51 #define isdigit(ch) ((ch) >= '0' && (ch) <= '9')
48 52 #define islower(ch) ((ch) >= 'a' && (ch) <= 'z')
49 53 #define isspace(ch) (((ch) == ' ') || ((ch) == '\r') || ((ch) == '\n') || \
50 54 ((ch) == '\t') || ((ch) == '\f'))
51 55 #define isupper(ch) ((ch) >= 'A' && (ch) <= 'Z')
52 56 #define isxdigit(ch) (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \
53 57 ((ch) >= 'A' && (ch) <= 'F'))
54 58
55 59 #endif /* _KERNEL && !_BOOT */
56 60
57 61 #define DIGIT(x) \
58 62 (isdigit(x) ? (x) - '0' : islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
59 63
60 64 #define MBASE ('z' - 'a' + 1 + 10)
61 65
62 66 /*
63 67 * The following macro is a version of isalnum() that limits alphabetic
64 68 * characters to the ranges a-z and A-Z; locale dependent characters will not
65 69 * return 1. The members of a-z and A-Z are assumed to be in ascending order
66 70 * and contiguous.
67 71 */
68 72 #define lisalnum(x) \
69 73 (isdigit(x) || ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z'))
70 74
71 75 #ifdef __cplusplus
72 76 }
73 77 #endif
74 78
75 79 #endif /* _COMMON_UTIL_CTYPE_H */
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX