Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mdb/tools/scripts/map2linktest.sh
+++ new/usr/src/cmd/mdb/tools/scripts/map2linktest.sh
1 1 #!/bin/ksh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 24 # Use is subject to license terms.
25 25 #
26 -#ident "%Z%%M% %I% %E% SMI"
27 -#
28 26
29 27 #
30 28 # Create dummy functions for each of the functions in the module API. We can
31 29 # then link a module against an object file created from the output of this
32 30 # script to determine whether or not that module restricts itself to the API.
33 31 # If the module uses functions outside of the module API, then it cannot be
34 32 # used as a kmdb module.
35 33 #
36 -nawk '
34 +/usr/xpg4/bin/awk '
37 35 /^[ ]*global:[ ]*$/ {
38 36 printing = 1;
39 37 next;
40 38 }
41 39
42 40 /^[ ]*local:[ ]*$/ {
43 41 printing = 0;
44 42 next;
45 43 }
46 44
47 45 # Skip blank lines and comments
48 46 /^$/ { next; }
49 47 /^[ ]*#/ { next;}
50 48
51 49 # Print globals only
52 50 printing == 0 { next; }
53 51
54 52 # Symbols beginning with "kmdb_" are not in the module API - they are
55 53 # private to kmdb.
56 54 $1 ~ /^kmdb_/ { next; }
57 55
58 56 # Symbols which have the token "variable" are seen as an int
59 57 $3 ~ /variable/ {
60 58 if (seen[$1]) {
61 59 next;
62 60 }
63 61
64 62 seen[$1] = 1;
65 63
66 64 printf("int %s = 0;\n", substr($1, 1, length($1) - 1));
67 65 next;
68 66 }
69 67
70 68 $1 !~ /;$/ { next; }
71 69
72 70 # Print everything else that we have not already seen as a function
73 71 # definition so we can create our filter.
74 72 {
75 73 if (seen[$1]) {
76 74 next;
77 75 }
78 76
79 77 seen[$1] = 1;
80 78
81 79 printf("void %s(void) {}\n", substr($1, 1, length($1) - 1));
82 80 }
83 81 '
84 82
85 83 #
86 84 # kmdb modules cannot have their own _init, _fini, or _info routines. By
87 85 # creating dummies for them here, a link against an object file created from
88 86 # the output of this script will fail if the module defines one of them.
89 87 #
90 88 echo "void _init(void) {}"
91 89 echo "void _info(void) {}"
92 90 echo "void _fini(void) {}"
93 91 #
94 92 # The SunStudio compiler may generate calls to _memcpy and so we
95 93 # need to make sure that the correct symbol exists for these calls.
96 94 #
97 95 echo "void _memcpy(void) {}"
↓ open down ↓ |
51 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX