| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: makesyscalls.sh,v 1.173 2019/06/18 16:24:17 christos Exp $ | | 1 | # $NetBSD: makesyscalls.sh,v 1.174 2019/10/09 01:43:00 christos Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou | | 3 | # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # Redistribution and use in source and binary forms, with or without | | 6 | # Redistribution and use in source and binary forms, with or without |
7 | # modification, are permitted provided that the following conditions | | 7 | # modification, are permitted provided that the following conditions |
8 | # are met: | | 8 | # are met: |
9 | # 1. Redistributions of source code must retain the above copyright | | 9 | # 1. Redistributions of source code must retain the above copyright |
10 | # notice, this list of conditions and the following disclaimer. | | 10 | # notice, this list of conditions and the following disclaimer. |
11 | # 2. Redistributions in binary form must reproduce the above copyright | | 11 | # 2. Redistributions in binary form must reproduce the above copyright |
12 | # notice, this list of conditions and the following disclaimer in the | | 12 | # notice, this list of conditions and the following disclaimer in the |
13 | # documentation and/or other materials provided with the distribution. | | 13 | # documentation and/or other materials provided with the distribution. |
14 | # 3. All advertising materials mentioning features or use of this software | | 14 | # 3. All advertising materials mentioning features or use of this software |
| @@ -60,57 +60,66 @@ esac | | | @@ -60,57 +60,66 @@ esac |
60 | # | | 60 | # |
61 | # NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'SYSLIBCOMPAT'. | | 61 | # NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'SYSLIBCOMPAT'. |
62 | | | 62 | |
63 | # source the config file. | | 63 | # source the config file. |
64 | sys_nosys="sys_nosys" # default is sys_nosys(), if not specified otherwise | | 64 | sys_nosys="sys_nosys" # default is sys_nosys(), if not specified otherwise |
65 | maxsysargs=8 # default limit is 8 (32bit) arguments | | 65 | maxsysargs=8 # default limit is 8 (32bit) arguments |
66 | systrace="/dev/null" | | 66 | systrace="/dev/null" |
67 | sysautoload="/dev/null" | | 67 | sysautoload="/dev/null" |
68 | rumpcalls="/dev/null" | | 68 | rumpcalls="/dev/null" |
69 | rumpcallshdr="/dev/null" | | 69 | rumpcallshdr="/dev/null" |
70 | rumpsysmap="/dev/null" | | 70 | rumpsysmap="/dev/null" |
71 | rumpsysent="rumpsysent.tmp" | | 71 | rumpsysent="rumpsysent.tmp" |
72 | rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS," | | 72 | rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS," |
73 | rumpnosys="(sy_call_t *)rumpns_enosys" | | 73 | rumpnosys="(sy_call_t *)(void *)rumpns_enosys" |
74 | rumpnomodule="(sy_call_t *)rumpns_sys_nomodule" | | 74 | rumpnomodule="(sy_call_t *)(void *)rumpns_sys_nomodule" |
75 | | | 75 | |
76 | case $1 in | | 76 | case $1 in |
77 | /*) . $1;; | | 77 | /*) . $1;; |
78 | *) . ./$1;; | | 78 | *) . ./$1;; |
79 | esac | | 79 | esac |
80 | | | 80 | |
81 | errmsg() | | 81 | errmsg() |
82 | { | | 82 | { |
83 | fail=true; | | 83 | fail=true; |
84 | printf '%s: %s\n' "$0" "$*" >&2 | | 84 | printf '%s: %s\n' "$0" "$*" >&2 |
85 | } | | 85 | } |
86 | | | 86 | |
| | | 87 | addsuffix() |
| | | 88 | { |
| | | 89 | if [ "$1" = "/dev/null" -o -z "$2" ]; then |
| | | 90 | echo $1 |
| | | 91 | else |
| | | 92 | echo $1.$2 |
| | | 93 | fi |
| | | 94 | } |
| | | 95 | |
87 | fail=false | | 96 | fail=false |
88 | case "${nsysent:-0}" in | | 97 | case "${nsysent:-0}" in |
89 | *[!0-9]*) errmsg "Non numeric value for nsysent:" "${nsysent}";; | | 98 | *[!0-9]*) errmsg "Non numeric value for nsysent:" "${nsysent}";; |
90 | esac | | 99 | esac |
91 | case "${maxsysargs:-0}" in | | 100 | case "${maxsysargs:-0}" in |
92 | *[!0-9]*) errmsg "Non numeric value for maxsysargs:" "${maxsysargs}";; | | 101 | *[!0-9]*) errmsg "Non numeric value for maxsysargs:" "${maxsysargs}";; |
93 | esac | | 102 | esac |
94 | $fail && exit 1 | | 103 | $fail && exit 1 |
95 | | | 104 | |
96 | # tmp files: | | 105 | # tmp files: |
97 | sysautoloadbottom="$sysautoload.bottom" | | 106 | sysautoloadbottom=$(addsuffix $sysautoload "bottom") |
98 | sysdcl="sysent.dcl" | | 107 | sysdcl="sysent.dcl" |
99 | sysprotos="sys.protos" | | 108 | sysprotos="sys.protos" |
100 | syscompat_pref="sysent." | | 109 | syscompat_pref="sysent." |
101 | sysent="sysent.switch" | | 110 | sysent="sysent.switch" |
102 | sysnamesbottom="$sysnames.bottom" | | 111 | sysnamesbottom=$(addsuffix $sysnames "bottom") |
103 | sysnamesfriendly="$sysnames.friendly" | | 112 | sysnamesfriendly=$(addsuffix $sysnames "friendly") |
104 | rumptypes="rumphdr.types" | | 113 | rumptypes="rumphdr.types" |
105 | rumpprotos="rumphdr.protos" | | 114 | rumpprotos="rumphdr.protos" |
106 | systracetmp="systrace.$$" | | 115 | systracetmp="systrace.$$" |
107 | systraceret="systraceret.$$" | | 116 | systraceret="systraceret.$$" |
108 | | | 117 | |
109 | cleanup() { | | 118 | cleanup() { |
110 | rm $sysdcl $sysprotos $sysent $sysnamesbottom $sysnamesfriendly $rumpsysent $rumptypes $rumpprotos $systracetmp $systraceret $sysautoloadbottom | | 119 | rm $sysdcl $sysprotos $sysent $sysnamesbottom $sysnamesfriendly $rumpsysent $rumptypes $rumpprotos $systracetmp $systraceret $sysautoloadbottom |
111 | } | | 120 | } |
112 | trap "cleanup" 0 | | 121 | trap "cleanup" 0 |
113 | | | 122 | |
114 | # Awk program (must support nawk extensions) | | 123 | # Awk program (must support nawk extensions) |
115 | # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere. | | 124 | # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere. |
116 | awk=${AWK:-awk} | | 125 | awk=${AWK:-awk} |
| @@ -164,47 +173,47 @@ BEGIN { | | | @@ -164,47 +173,47 @@ BEGIN { |
164 | # to allow nested #if/#else/#endif sets | | 173 | # to allow nested #if/#else/#endif sets |
165 | savedepth = 0 | | 174 | savedepth = 0 |
166 | # to track already processed syscalls | | 175 | # to track already processed syscalls |
167 | | | 176 | |
168 | sysnames = \"$sysnames\" | | 177 | sysnames = \"$sysnames\" |
169 | sysprotos = \"$sysprotos\" | | 178 | sysprotos = \"$sysprotos\" |
170 | sysnumhdr = \"$sysnumhdr\" | | 179 | sysnumhdr = \"$sysnumhdr\" |
171 | sysarghdr = \"$sysarghdr\" | | 180 | sysarghdr = \"$sysarghdr\" |
172 | sysarghdrextra = \"$sysarghdrextra\" | | 181 | sysarghdrextra = \"$sysarghdrextra\" |
173 | systrace = \"$systrace\" | | 182 | systrace = \"$systrace\" |
174 | systracetmp = \"$systracetmp\" | | 183 | systracetmp = \"$systracetmp\" |
175 | systraceret = \"$systraceret\" | | 184 | systraceret = \"$systraceret\" |
176 | sysautoload = \"$sysautoload\" | | 185 | sysautoload = \"$sysautoload\" |
177 | sysautoloadbottom = \"${sysautoload}.bottom\" | | 186 | sysautoloadbottom = \"$sysautoloadbottom\" |
178 | rumpcalls = \"$rumpcalls\" | | 187 | rumpcalls = \"$rumpcalls\" |
179 | rumpcallshdr = \"$rumpcallshdr\" | | 188 | rumpcallshdr = \"$rumpcallshdr\" |
180 | rumpsysent = \"$rumpsysent\" | | 189 | rumpsysent = \"$rumpsysent\" |
181 | rumpsysmap = \"$rumpsysmap\" | | 190 | rumpsysmap = \"$rumpsysmap\" |
182 | switchname = \"$switchname\" | | 191 | switchname = \"$switchname\" |
183 | namesname = \"$namesname\" | | 192 | namesname = \"$namesname\" |
184 | constprefix = \"$constprefix\" | | 193 | constprefix = \"$constprefix\" |
185 | emulname = \"$emulname\" | | 194 | emulname = \"$emulname\" |
186 | registertype = \"$registertype\" | | 195 | registertype = \"$registertype\" |
187 | sysalign=\"$sysalign\" | | 196 | sysalign=\"$sysalign\" |
188 | if (!registertype) { | | 197 | if (!registertype) { |
189 | registertype = \"register_t\" | | 198 | registertype = \"register_t\" |
190 | } | | 199 | } |
191 | nsysent = ${nsysent:-0} | | 200 | nsysent = ${nsysent:-0} |
192 | | | 201 | |
193 | sysdcl = \"$sysdcl\" | | 202 | sysdcl = \"$sysdcl\" |
194 | syscompat_pref = \"$syscompat_pref\" | | 203 | syscompat_pref = \"$syscompat_pref\" |
195 | sysent = \"$sysent\" | | 204 | sysent = \"$sysent\" |
196 | sysnamesbottom = \"${sysnames}.bottom\" | | 205 | sysnamesbottom = \"$sysnamesbottom\" |
197 | sysnamesfriendly = \"${sysnames}.friendly\" | | 206 | sysnamesfriendly = \"$sysnamesfriendly\" |
198 | rumpprotos = \"$rumpprotos\" | | 207 | rumpprotos = \"$rumpprotos\" |
199 | rumptypes = \"$rumptypes\" | | 208 | rumptypes = \"$rumptypes\" |
200 | sys_nosys = \"$sys_nosys\" | | 209 | sys_nosys = \"$sys_nosys\" |
201 | maxsysargs = ${maxsysargs:-8} | | 210 | maxsysargs = ${maxsysargs:-8} |
202 | rumpnoflags=\"$rumpnoflags\" | | 211 | rumpnoflags=\"$rumpnoflags\" |
203 | rumpnosys=\"$rumpnosys\" | | 212 | rumpnosys=\"$rumpnosys\" |
204 | rumpnomodule=\"$rumpnomodule\" | | 213 | rumpnomodule=\"$rumpnomodule\" |
205 | infile = \"$2\" | | 214 | infile = \"$2\" |
206 | | | 215 | |
207 | compatopts = \"$compatopts\" | | 216 | compatopts = \"$compatopts\" |
208 | "' | | 217 | "' |
209 | | | 218 | |
210 | if (rumpcalls != "/dev/null") | | 219 | if (rumpcalls != "/dev/null") |