makesyscalls.sh revision 1.154 1 # $NetBSD: makesyscalls.sh,v 1.154 2015/09/24 14:30:52 christos Exp $
2 #
3 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. All advertising materials mentioning features or use of this software
15 # must display the following acknowledgement:
16 # This product includes software developed for the NetBSD Project
17 # by Christopher G. Demetriou.
18 # 4. The name of the author may not be used to endorse or promote products
19 # derived from this software without specific prior written permission
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 # @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
33
34 set -e
35
36 case $# in
37 2) ;;
38 *) echo "Usage: $0 config-file input-file" 1>&2
39 exit 1
40 ;;
41 esac
42
43 # the config file sets the following variables:
44 # sysalign check for alignment of off_t/dev_t/time_t
45 # sysnames the syscall names file
46 # sysnumhdr the syscall numbers file
47 # syssw the syscall switch file
48 # sysautoload the syscall autoload definitions file
49 # sysarghdr the syscall argument struct definitions
50 # compatopts those syscall types that are for 'compat' syscalls
51 # switchname the name for the 'struct sysent' we define
52 # namesname the name for the 'const char *[]' we define
53 # constprefix the prefix for the system call constants
54 # registertype the type for register_t
55 # nsysent the size of the sysent table
56 # sys_nosys [optional] name of function called for unsupported
57 # syscalls, if not sys_nosys()
58 # maxsysargs [optiona] the maximum number or arguments
59 #
60 # NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'SYSLIBCOMPAT'.
61
62 # source the config file.
63 sys_nosys="sys_nosys" # default is sys_nosys(), if not specified otherwise
64 maxsysargs=8 # default limit is 8 (32bit) arguments
65 systrace="/dev/null"
66 sysautoload="/dev/null"
67 rumpcalls="/dev/null"
68 rumpcallshdr="/dev/null"
69 rumpsysmap="/dev/null"
70 rumpsysent="rumpsysent.tmp"
71 rumpnoflags="\n\t\t.sy_flags = SYCALL_NOSYS,"
72 rumpnosys="(sy_call_t *)rumpns_enosys"
73 rumpnomodule="(sy_call_t *)rumpns_sys_nomodule"
74
75 case $1 in
76 /*) . $1;;
77 *) . ./$1;;
78 esac
79
80 # tmp files:
81 sysdcl="sysent.dcl"
82 sysprotos="sys.protos"
83 syscompat_pref="sysent."
84 sysent="sysent.switch"
85 sysnamesbottom="$sysnames.bottom"
86 sysnamesfriendly="$sysnames.friendly"
87 rumptypes="rumphdr.types"
88 rumpprotos="rumphdr.protos"
89 systracetmp="systrace.$$"
90 systraceret="systraceret.$$"
91
92 cleanup() {
93 rm $sysdcl $sysprotos $sysent $sysnamesbottom $sysnamesfriendly $rumpsysent $rumptypes $rumpprotos $systracetmp $systraceret
94 }
95 trap "cleanup" 0
96
97 # Awk program (must support nawk extensions)
98 # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
99 awk=${AWK:-awk}
100
101 # Does this awk have a "toupper" function?
102 have_toupper="$($awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null)"
103
104 # If this awk does not define "toupper" then define our own.
105 if [ "$have_toupper" = TRUE ] ; then
106 # Used awk (GNU awk or nawk) provides it
107 toupper=
108 else
109 # Provide our own toupper()
110 toupper='
111 function toupper(str) {
112 _toupper_cmd = "echo "str" |tr a-z A-Z"
113 _toupper_cmd | getline _toupper_str;
114 close(_toupper_cmd);
115 return _toupper_str;
116 }'
117 fi
118
119 # before handing it off to awk, make a few adjustments:
120 # (1) insert spaces around {, }, (, ), *, and commas.
121 # (2) get rid of any and all dollar signs (so that rcs id use safe)
122 #
123 # The awk script will deal with blank lines and lines that
124 # start with the comment character (';').
125
126 sed -e '
127 s/\$//g
128 :join
129 /\\$/{a\
130
131 N
132 s/\\\n//
133 b join
134 }
135 2,${
136 /^#/!s/\([{}()*,|]\)/ \1 /g
137 }
138 ' < $2 | $awk "
139 $toupper
140 BEGIN {
141 # Create a NetBSD tag that does not get expanded when checking
142 # this script out of CVS. (This part of the awk script is in a
143 # shell double-quoted string, so the backslashes are eaten by
144 # the shell.)
145 tag = \"\$\" \"NetBSD\" \"\$\"
146
147 # to allow nested #if/#else/#endif sets
148 savedepth = 0
149 auto_skip = 0
150 # to track already processed syscalls
151
152 sysnames = \"$sysnames\"
153 sysprotos = \"$sysprotos\"
154 sysnumhdr = \"$sysnumhdr\"
155 sysarghdr = \"$sysarghdr\"
156 sysarghdrextra = \"$sysarghdrextra\"
157 systrace = \"$systrace\"
158 systracetmp = \"$systracetmp\"
159 systraceret = \"$systraceret\"
160 sysautoload = \"$sysautoload\"
161 rumpcalls = \"$rumpcalls\"
162 rumpcallshdr = \"$rumpcallshdr\"
163 rumpsysent = \"$rumpsysent\"
164 rumpsysmap = \"$rumpsysmap\"
165 switchname = \"$switchname\"
166 namesname = \"$namesname\"
167 constprefix = \"$constprefix\"
168 registertype = \"$registertype\"
169 sysalign=\"$sysalign\"
170 if (!registertype) {
171 registertype = \"register_t\"
172 }
173 nsysent = \"$nsysent\"
174
175 sysdcl = \"$sysdcl\"
176 syscompat_pref = \"$syscompat_pref\"
177 sysent = \"$sysent\"
178 sysnamesbottom = \"${sysnames}.bottom\"
179 sysnamesfriendly = \"${sysnames}.friendly\"
180 rumpprotos = \"$rumpprotos\"
181 rumptypes = \"$rumptypes\"
182 sys_nosys = \"$sys_nosys\"
183 maxsysargs = \"$maxsysargs\"
184 rumpnoflags=\"$rumpnoflags\"
185 rumpnosys=\"$rumpnosys\"
186 rumpnomodule=\"$rumpnomodule\"
187 infile = \"$2\"
188
189 compatopts = \"$compatopts\"
190 "'
191
192 if (rumpcalls != "/dev/null")
193 haverumpcalls = 1
194
195 printf "/* %s */\n\n", tag > sysdcl
196 printf "/*\n * System call switch table.\n *\n" > sysdcl
197 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
198
199 ncompat = split(compatopts,compat)
200 for (i = 1; i <= ncompat; i++) {
201 compat_upper[i] = toupper(compat[i])
202
203 printf "\n#ifdef %s\n", compat_upper[i] > sysent
204 printf "#define %s(func) __CONCAT(%s_,func)\n", compat[i], \
205 compat[i] > sysent
206 printf "#else\n" > sysent
207 printf "#define %s(func) %s\n", compat[i], sys_nosys > sysent
208 printf "#endif\n" > sysent
209 }
210
211 printf "\n#define\ts(type)\tsizeof(type)\n" > sysent
212 printf "#define\tn(type)\t(sizeof(type)/sizeof (%s))\n", registertype > sysent
213 printf "#define\tns(type)\t.sy_narg = n(type), .sy_argsize = s(type)\n\n", registertype > sysent
214 printf "struct sysent %s[] = {\n",switchname > sysent
215
216 printf "/* %s */\n\n", tag > sysnames
217 printf "/*\n * System call names.\n *\n" > sysnames
218 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
219
220 printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos
221 if (haverumpcalls)
222 printf("#ifndef RUMP_CLIENT\n") > sysprotos
223
224 printf "/* %s */\n\n", tag > sysnumhdr
225 printf "/*\n * System call numbers.\n *\n" > sysnumhdr
226 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
227
228 printf "/* %s */\n\n", tag > sysarghdr
229 printf "/*\n * System call argument lists.\n *\n" > sysarghdr
230 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr
231
232 printf "/* %s */\n\n", tag > sysautoload
233 printf "/*\n * System call autoload table.\n *\n" > sysautoload
234 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysautoload
235
236 printf "/* %s */\n\n", tag > rumpcalls
237 printf "/*\n * System call vector and marshalling for rump.\n *\n" > rumpcalls
238 printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcalls
239
240 printf "/* %s */\n\n", tag > rumpcallshdr
241 printf "/*\n * System call protos in rump namespace.\n *\n" > rumpcallshdr
242 printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcallshdr
243
244 printf "/* %s */\n\n", tag > systrace
245 printf "/*\n * System call argument to DTrace register array converstion.\n *\n" > systrace
246 printf " * DO NOT EDIT-- this file is automatically generated.\n" > systrace
247 }
248 NR == 1 {
249 sub(/ $/, "")
250 printf " * created from%s\n */\n\n", $0 > sysdcl
251 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysdcl
252
253 printf " * created from%s\n */\n\n", $0 > sysnames
254 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysnames
255
256 printf " * created from%s\n */\n\n", $0 > sysautoload
257 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysautoload
258 printf("static struct {\n") > sysautoload
259 printf("\tu_int\t\tal_code;\n") > sysautoload
260 printf("\tconst char\t*al_module;\n") > sysautoload
261 printf("} const syscalls_autoload[] = {\n") > sysautoload
262
263 printf " * created from%s\n */\n\n", $0 > rumpcalls
264 printf "#ifdef RUMP_CLIENT\n" > rumpcalls
265 printf "#include <rump/rumpuser_port.h>\n" > rumpcalls
266 printf "#endif /* RUMP_CLIENT */\n\n" > rumpcalls
267 printf "#include <sys/param.h>\n\n" > rumpcalls
268 printf "#ifdef __NetBSD__\n" > rumpcalls
269 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > rumpcalls
270
271 printf "#include <sys/fstypes.h>\n" > rumpcalls
272 printf "#include <sys/proc.h>\n" > rumpcalls
273 printf "#endif /* __NetBSD__ */\n\n" > rumpcalls
274 printf "#ifdef RUMP_CLIENT\n" > rumpcalls
275 printf "#include <errno.h>\n" > rumpcalls
276 printf "#include <stdint.h>\n" > rumpcalls
277 printf "#include <stdlib.h>\n" > rumpcalls
278 printf "#include <string.h>\n\n" > rumpcalls
279 printf "#include <srcsys/syscall.h>\n" > rumpcalls
280 printf "#include <srcsys/syscallargs.h>\n\n" > rumpcalls
281 printf "#include <rump/rumpclient.h>\n\n" > rumpcalls
282 printf "#define rsys_syscall(num, data, dlen, retval)\t\\\n" > rumpcalls
283 printf " rumpclient_syscall(num, data, dlen, retval)\n" > rumpcalls
284 printf "#define rsys_seterrno(error) errno = error\n" > rumpcalls
285 printf "#else\n" > rumpcalls
286 printf "#include <sys/syscall.h>\n" > rumpcalls
287 printf "#include <sys/syscallargs.h>\n\n" > rumpcalls
288 printf "#include <sys/syscallvar.h>\n\n" > rumpcalls
289 printf "#include <rump/rumpuser.h>\n" > rumpcalls
290 printf "#include \"rump_private.h\"\n\n" > rumpcalls
291 printf "#define rsys_syscall(num, data, dlen, retval)\t\\\n" > rumpcalls
292 printf " rump_syscall(num, data, dlen, retval)\n\n" > rumpcalls
293 printf "#define rsys_seterrno(error) rumpuser_seterrno(error)\n" \
294 > rumpcalls
295 printf "#endif\n\n" > rumpcalls
296
297 printf "#ifndef RUMP_KERNEL_IS_LIBC\n" > rumpcalls
298 printf "#define RUMP_SYS_COMPAT\n" > rumpcalls
299 printf "#endif\n\n" > rumpcalls
300
301 printf "#if\tBYTE_ORDER == BIG_ENDIAN\n" > rumpcalls
302 printf "#define SPARG(p,k)\t((p)->k.be.datum)\n" > rumpcalls
303 printf "#else /* LITTLE_ENDIAN, I hope dearly */\n" > rumpcalls
304 printf "#define SPARG(p,k)\t((p)->k.le.datum)\n" > rumpcalls
305 printf "#endif\n\n" > rumpcalls
306 printf "\nvoid rumpns_sys_nomodule(void);\n" > rumpcalls
307
308 printf "\n#ifndef RUMP_CLIENT\n" > rumpsysent
309 printf "int rumpns_enosys(void);\n" > rumpsysent
310 printf "#define\ts(type)\tsizeof(type)\n" > rumpsysent
311 printf "#define\tn(type)\t(sizeof(type)/sizeof (%s))\n", registertype > rumpsysent
312 printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > rumpsysent
313 printf "struct sysent rump_sysent[] = {\n" > rumpsysent
314
315 # System call names are included by userland (kdump(1)), so
316 # hide the include files from it.
317 printf "#if defined(_KERNEL_OPT)\n" > sysnames
318
319 printf "#else /* _KERNEL_OPT */\n" > sysnamesbottom
320 printf "#include <sys/null.h>\n" > sysnamesbottom
321 printf "#endif /* _KERNEL_OPT */\n\n" > sysnamesbottom
322 printf "const char *const %s[] = {\n",namesname > sysnamesbottom
323 printf "\n\n/* libc style syscall names */\n" > sysnamesfriendly
324 printf "const char *const alt%s[] = {\n", namesname > sysnamesfriendly
325
326 printf " * created from%s\n */\n\n", $0 > sysnumhdr
327 printf "#ifndef _" constprefix "SYSCALL_H_\n" > sysnumhdr
328 printf "#define _" constprefix "SYSCALL_H_\n\n" > sysnumhdr
329
330 printf " * created from%s\n */\n\n", $0 > sysarghdr
331 printf "#ifndef _" constprefix "SYSCALLARGS_H_\n" > sysarghdr
332 printf "#define _" constprefix "SYSCALLARGS_H_\n\n" > sysarghdr
333
334 printf " * created from%s\n */\n\n", $0 > rumpcallshdr
335 printf "#ifndef _RUMP_RUMP_SYSCALLS_H_\n" > rumpcallshdr
336 printf "#define _RUMP_RUMP_SYSCALLS_H_\n\n" > rumpcallshdr
337 printf "#ifdef _KERNEL\n" > rumpcallshdr
338 printf "#error Interface not supported inside kernel\n" > rumpcallshdr
339 printf "#endif /* _KERNEL */\n\n" > rumpcallshdr
340 printf "#include <rump/rump_syscalls_compat.h>\n\n" > rumpcallshdr
341
342 printf "%s", sysarghdrextra > sysarghdr
343 # Write max number of system call arguments to both headers
344 printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
345 > sysnumhdr
346 printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
347 > sysarghdr
348 printf "#undef\tsyscallarg\n" > sysarghdr
349 printf "#define\tsyscallarg(x)\t\t\t\t\t\t\t\\\n" > sysarghdr
350 printf "\tunion {\t\t\t\t\t\t\t\t\\\n" > sysarghdr
351 printf "\t\t%s pad;\t\t\t\t\t\t\\\n", registertype > sysarghdr
352 printf "\t\tstruct { x datum; } le;\t\t\t\t\t\\\n" > sysarghdr
353 printf "\t\tstruct { /* LINTED zero array dimension */\t\t\\\n" \
354 > sysarghdr
355 printf "\t\t\tint8_t pad[ /* CONSTCOND */\t\t\t\\\n" > sysarghdr
356 printf "\t\t\t\t(sizeof (%s) < sizeof (x))\t\\\n", \
357 registertype > sysarghdr
358 printf "\t\t\t\t? 0\t\t\t\t\t\\\n" > sysarghdr
359 printf "\t\t\t\t: sizeof (%s) - sizeof (x)];\t\\\n", \
360 registertype > sysarghdr
361 printf "\t\t\tx datum;\t\t\t\t\t\\\n" > sysarghdr
362 printf "\t\t} be;\t\t\t\t\t\t\t\\\n" > sysarghdr
363 printf "\t}\n" > sysarghdr
364 printf("\n#undef check_syscall_args\n") >sysarghdr
365 printf("#define check_syscall_args(call) /*LINTED*/ \\\n" \
366 "\ttypedef char call##_check_args" \
367 "[sizeof (struct call##_args) \\\n" \
368 "\t\t<= %sMAXSYSARGS * sizeof (%s) ? 1 : -1];\n", \
369 constprefix, registertype) >sysarghdr
370
371 printf " * This file is part of the DTrace syscall provider.\n */\n\n" > systrace
372 printf "static void\nsystrace_args(register_t sysnum, const void *params, uintptr_t *uarg, size_t *n_args)\n{\n" > systrace
373 printf "\tintptr_t *iarg = (intptr_t *)uarg;\n" > systrace
374 printf "\tswitch (sysnum) {\n" > systrace
375
376 printf "static void\nsystrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)\n{\n\tconst char *p = NULL;\n" > systracetmp
377 printf "\tswitch (sysnum) {\n" > systracetmp
378
379 printf "static void\nsystrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)\n{\n\tconst char *p = NULL;\n" > systraceret
380 printf "\tswitch (sysnum) {\n" > systraceret
381
382 # compat types from syscalls.master. this is slightly ugly,
383 # but given that we have so few compats from over 17 years,
384 # a more complicated solution is not currently warranted.
385 uncompattypes["struct timeval50"] = "struct timeval";
386 uncompattypes["struct timespec50"] = "struct timespec";
387 uncompattypes["struct stat30"] = "struct stat";
388
389 next
390 }
391 NF == 0 || $1 ~ /^;/ {
392 next
393 }
394 $0 ~ /^%%$/ {
395 intable = 1
396 next
397 }
398 $1 ~ /^#[ ]*include/ {
399 print > sysdcl
400 print > sysnames
401 next
402 }
403 $1 ~ /^#/ && !intable {
404 print > sysdcl
405 print > sysnames
406 next
407 }
408 $1 ~ /^#/ && intable {
409 if ($1 ~ /^#[ ]*if/) {
410 savedepth++
411 savesyscall[savedepth] = syscall
412 skip_auto[savedepth] = auto_skip
413 auto_skip = 0
414
415 # Special handling for sysautoload conditionals
416 #
417 # We ignore all conditions other than those for
418 # !defined(_LP64) which are used for SYSV* syscalls
419 # only
420
421 if ($0 ~ /!defined\(_LP64\)/) {
422 printf("#if !defined(_LP64)\n") > sysautoload
423 auto_skip = savedepth
424 }
425 }
426 if ($1 ~ /^#[ ]*else/) {
427 if (savedepth <= 0) {
428 printf("%s: line %d: unbalanced #else\n", \
429 infile, NR)
430 exit 1
431 }
432 if (auto_skip == savedepth) {
433 print > sysautoload
434 }
435 syscall = savesyscall[savedepth]
436 }
437 if ($1 ~ /^#[ ]*endif/) {
438 if (savedepth <= 0) {
439 printf("%s: line %d: unbalanced #endif\n", \
440 infile, NR)
441 exit 1
442 }
443 if (auto_skip == savedepth) {
444 print > sysautoload
445 }
446 auto_skip = skip_auto[savedepth];
447 savedepth--
448 }
449 print > sysent
450 print > sysarghdr
451 print > sysnumhdr
452 print > sysprotos
453 print > sysnamesbottom
454 print > sysnamesfriendly
455 print > systrace
456 print > systracetmp
457 print > systraceret
458
459 # XXX: technically we do not want to have conditionals in rump,
460 # but it is easier to just let the cpp handle them than try to
461 # figure out what we want here in this script
462 print > rumpsysent
463 next
464 }
465 syscall != $1 {
466 printf "%s: line %d: syscall number out of sync at %d\n", \
467 infile, NR, syscall
468 printf "line is:\n"
469 print
470 exit 1
471 }
472 function parserr(was, wanted) {
473 printf "%s: line %d: unexpected %s (expected <%s>)\n", \
474 infile, NR, was, wanted
475 printf "line is:\n"
476 print
477 exit 1
478 }
479 function fillerpsysent(syscall, flags, name, comment) {
480 return sprintf("\t{%s\n\t\t.sy_call = %s,\n\t},\t\t/* %d = filler */",\
481 flags, name, syscall, comment);
482 }
483 function parseline() {
484 f=3 # toss number and type
485 if ($2 == "INDIR")
486 sycall_flags="SYCALL_INDIRECT"
487 else
488 sycall_flags="0"
489 if ($NF != "}") {
490 funcalias=$NF
491 end=NF-1
492 } else {
493 funcalias=""
494 end=NF
495 }
496 if ($f == "INDIR") { # allow for "NOARG INDIR"
497 sycall_flags = "SYCALL_INDIRECT | " sycall_flags
498 f++
499 }
500 if ($f == "MODULAR") { # registered at runtime
501 modular = 1
502 f++
503 modname = $f
504 f++
505 } else {
506 modular = 0;
507 }
508 if ($f == "RUMP") {
509 rumpable = 1
510 f++
511 } else {
512 rumpable = 0
513 }
514 if ($f ~ /^[a-z0-9_]*$/) { # allow syscall alias
515 funcalias=$f
516 f++
517 }
518 if ($f != "{")
519 parserr($f, "{")
520 f++
521 if ($end != "}")
522 parserr($end, "}")
523 end--
524 if ($end != ";")
525 parserr($end, ";")
526 end--
527 if ($end != ")")
528 parserr($end, ")")
529 end--
530
531 returntype = oldf = "";
532 do {
533 if (returntype != "" && oldf != "*")
534 returntype = returntype" ";
535 returntype = returntype$f;
536 oldf = $f;
537 f++
538 } while ($f != "|" && f < (end-1))
539 if (f == (end - 1)) {
540 parserr($f, "function argument definition (maybe \"|\"?)");
541 }
542 f++
543
544 fprefix=$f
545 f++
546 if ($f != "|") {
547 parserr($f, "function compat delimiter (maybe \"|\"?)");
548 }
549 f++
550
551 fcompat=""
552 if ($f != "|") {
553 fcompat=$f
554 f++
555 }
556
557 if ($f != "|") {
558 parserr($f, "function name delimiter (maybe \"|\"?)");
559 }
560 f++
561 fbase=$f
562
563 # pipe is special in how to returns its values.
564 # So just generate it manually if present.
565 if (rumpable == 1 && fbase == "pipe") {
566 rumpable = 0;
567 rumphaspipe = 1;
568 }
569
570 if (fcompat != "") {
571 funcname=fprefix "___" fbase "" fcompat
572 } else {
573 funcname=fprefix "_" fbase
574 }
575 if (returntype == "quad_t" || returntype == "off_t") {
576 if (sycall_flags == "0")
577 sycall_flags = "SYCALL_RET_64";
578 else
579 sycall_flags = "SYCALL_RET_64 | " sycall_flags;
580 }
581
582 if (funcalias == "") {
583 funcalias=funcname
584 sub(/^([^_]+_)*sys_/, "", funcalias)
585 realname=fbase
586 } else {
587 realname=funcalias
588 }
589 rumpfname=realname "" fcompat
590 f++
591
592 if ($f != "(")
593 parserr($f, "(")
594 f++
595
596 argc=0;
597 argalign=0;
598 if (f == end) {
599 if ($f != "void")
600 parserr($f, "argument definition")
601 isvarargs = 0;
602 varargc = 0;
603 argtype[0]="void";
604 return
605 }
606
607 # some system calls (open() and fcntl()) can accept a variable
608 # number of arguments. If syscalls accept a variable number of
609 # arguments, they must still have arguments specified for
610 # the remaining argument "positions," because of the way the
611 # kernel system call argument handling works.
612 #
613 # Indirect system calls, e.g. syscall(), are exceptions to this
614 # rule, since they are handled entirely by machine-dependent code
615 # and do not need argument structures built.
616
617 isvarargs = 0;
618 args64 = 0;
619 ptr = 0;
620 while (f <= end) {
621 if ($f == "...") {
622 f++;
623 isvarargs = 1;
624 varargc = argc;
625 continue;
626 }
627 argc++
628 argtype[argc]=""
629 oldf=""
630 while (f < end && $(f+1) != ",") {
631 if (argtype[argc] != "" && oldf != "*")
632 argtype[argc] = argtype[argc]" ";
633 argtype[argc] = argtype[argc]$f;
634 oldf = $f;
635 f++
636 }
637 if (argtype[argc] == "")
638 parserr($f, "argument definition")
639 if (argtype[argc] == "off_t" \
640 || argtype[argc] == "dev_t" \
641 || argtype[argc] == "time_t") {
642 if ((argalign % 2) != 0 && sysalign &&
643 funcname != "sys_posix_fadvise") # XXX for now
644 parserr($f, "a padding argument")
645 } else {
646 argalign++;
647 }
648 if (argtype[argc] == "quad_t" || argtype[argc] == "off_t" \
649 || argtype[argc] == "dev_t" || argtype[argc] == "time_t") {
650 if (sycall_flags == "0")
651 sycall_flags = "SYCALL_ARG"argc-1"_64";
652 else
653 sycall_flags = "SYCALL_ARG"argc-1"_64 | " sycall_flags;
654 args64++;
655 }
656 if (index(argtype[argc], "*") != 0 && ptr == 0) {
657 if (sycall_flags == "0")
658 sycall_flags = "SYCALL_ARG_PTR";
659 else
660 sycall_flags = "SYCALL_ARG_PTR | " sycall_flags;
661 ptr = 1;
662 }
663 argname[argc]=$f;
664 f += 2; # skip name, and any comma
665 }
666 if (args64 > 0)
667 sycall_flags = "SYCALL_NARGS64_VAL("args64") | " sycall_flags;
668 # must see another argument after varargs notice.
669 if (isvarargs) {
670 if (argc == varargc)
671 parserr($f, "argument definition")
672 } else
673 varargc = argc;
674 }
675
676 function printproto(wrap) {
677 printf("/* syscall: \"%s%s\" ret: \"%s\" args:", wrap, funcalias,
678 returntype) > sysnumhdr
679 for (i = 1; i <= varargc; i++)
680 printf(" \"%s\"", argtype[i]) > sysnumhdr
681 if (isvarargs)
682 printf(" \"...\"") > sysnumhdr
683 printf(" */\n") > sysnumhdr
684 printf("#define\t%s%s%s\t%d\n\n", constprefix, wrap, funcalias,
685 syscall) > sysnumhdr
686
687 # output entry for syscall autoload table, if modular
688 if (modular ) {
689 printf("\t { %s%s%s, \"%s\" },\n", constprefix, wrap,
690 funcalias, modname) > sysautoload
691 }
692
693
694 # rumpalooza
695 if (!rumpable)
696 return
697
698 # accumulate fbases we have seen. we want the last
699 # occurence for the default __RENAME()
700 seen = funcseen[fbase]
701 funcseen[fbase] = rumpfname
702 # special case for mknod as type of last argument changed from
703 # uint32_t to dev_t
704 if ((seen && fbase != "mknod") || (!seen && fbase == "mknod"))
705 return
706
707 printf("%s rump_sys_%s(", returntype, realname) > rumpprotos
708
709 for (i = 1; i < varargc; i++)
710 if (argname[i] != "PAD")
711 printf("%s, ", uncompattype(argtype[i])) > rumpprotos
712
713 if (isvarargs)
714 printf("%s, ...)", uncompattype(argtype[varargc]))>rumpprotos
715 else
716 printf("%s)", uncompattype(argtype[argc])) > rumpprotos
717
718 printf(" __RENAME(RUMP_SYS_RENAME_%s)", toupper(fbase))> rumpprotos
719 printf(";\n") > rumpprotos
720
721 # generate forward-declares for types, apart from the
722 # braindead typedef jungle we cannot easily handle here
723 for (i = 1; i <= varargc; i++) {
724 type=uncompattype(argtype[i])
725 sub("const ", "", type)
726 ntype=type
727 sub(" *\\*.*", "", ntype);
728 if (!typeseen[ntype] && \
729 match(type, "struct") && match(type, "\\*")) {
730 typeseen[ntype] = 1
731 printf("%s;\n", ntype) > rumptypes
732 }
733 }
734 }
735
736 function printrumpsysent(insysent, compatwrap) {
737 if (modular) {
738 fn = rumpnomodule
739 flags = rumpnoflags
740 } else {
741 fn = rumpnosys
742 flags = ""
743 }
744 if (!insysent) {
745 printf("\t{%s\n\t\t.sy_call = %s,\n},\t\t/* %d = %s */\n", \
746 flags, fn, syscall, funcalias) > rumpsysent
747 return
748 }
749
750 printf("\t{") > rumpsysent
751 if (argc != 0) {
752 printf("\n\t\tns(struct %ssys_%s_args),", compatwrap_, funcalias) > rumpsysent
753 }
754
755 printf("\n\t\t.sy_call = %s,\n\t},", fn) > rumpsysent
756 printf("\t\t/* %d = %s%s */\n", syscall, compatwrap_, funcalias) > rumpsysent
757 }
758
759 function iscompattype(type) {
760 for (var in uncompattypes) {
761 if (match(type, var)) {
762 return 1
763 }
764 }
765
766 return 0
767 }
768
769 function uncompattype(type) {
770 for (var in uncompattypes) {
771 if (match(type, var)) {
772 sub(var, uncompattypes[var], type)
773 return type
774 }
775 }
776
777 return type
778 }
779
780 function printrumpsysmap(syscall, wfn, funcalias, rumpentry) {
781 printf("%-4d %-22s %-18s %s\n",
782 syscall, wfn, funcalias, rumpentry) > rumpsysmap
783 }
784
785 function putsystrace(type, compatwrap_) {
786 printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace
787 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp
788 printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systraceret
789 if (argc > 0) {
790 printf("\t\tswitch(ndx) {\n") > systracetmp
791 printf("\t\tstruct %s%s_args *p = params;\n", compatwrap_, funcname) > systrace
792 for (i = 1; i <= argc; i++) {
793 arg = argtype[i]
794 sub("__restrict$", "", arg)
795 printf("\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", i - 1, arg) > systracetmp
796 if (arg ~ /.*p_t$/ || arg ~ /.*p$/ || arg ~ /.*_t_p$/ ||
797 arg ~ /.*_pointer_t$/)
798 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s).i32; /* %s */\n", \
799 i - 1, \
800 argname[i], arg) > systrace
801 else if (index(arg, "*") > 0 || arg == "caddr_t")
802 printf("\t\tuarg[%d] = (intptr_t) SCARG(p, %s); /* %s */\n", \
803 i - 1, \
804 argname[i], arg) > systrace
805 else if (substr(arg, 1, 1) == "u" || arg == "size_t")
806 printf("\t\tuarg[%d] = SCARG(p, %s); /* %s */\n", \
807 i - 1, \
808 argname[i], arg) > systrace
809 else
810 printf("\t\tiarg[%d] = SCARG(p, %s); /* %s */\n", \
811 i - 1, \
812 argname[i], arg) > systrace
813 }
814 printf("\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") > systracetmp
815
816 printf("\t\tif (ndx == 0 || ndx == 1)\n") > systraceret
817 printf("\t\t\tp = \"%s\";\n", returntype) > systraceret
818 printf("\t\tbreak;\n") > systraceret
819 }
820 printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace
821 printf("\t\tbreak;\n") > systracetmp
822 }
823
824 function putent(type, compatwrap) {
825 # output syscall declaration for switch table.
826 if (compatwrap == "")
827 compatwrap_ = ""
828 else
829 compatwrap_ = compatwrap "_"
830 if (argc == 0)
831 arg_type = "void";
832 else {
833 arg_type = "struct " compatwrap_ funcname "_args";
834 }
835 putsystrace(type, compatwrap_)
836 proto = "int\t" compatwrap_ funcname "(struct lwp *, const " \
837 arg_type " *, register_t *);\n"
838 if (sysmap[proto] != 1) {
839 sysmap[proto] = 1;
840 print proto > sysprotos;
841 }
842
843 # output syscall switch entry
844 printf("\t{") > sysent
845 if (argc != 0) {
846 printf("\n\t\tns(struct %s%s_args),", compatwrap_, funcname) > sysent
847 }
848 if (modular)
849 wfn = "sys_nomodule";
850 else if (compatwrap == "")
851 wfn = funcname;
852 else
853 wfn = compatwrap "(" funcname ")";
854 wfn_cast="(sy_call_t *)" wfn
855 if (sycall_flags != "0")
856 flags = "\n\t\t.sy_flags = " sycall_flags ","
857 else
858 flags = ""
859 printf("%s\n\t\t.sy_call = %s\n\t},", flags, wfn_cast) > sysent
860 printf("\t\t/* %d = %s%s */\n", syscall, compatwrap_, funcalias) > sysent
861
862 # output syscall name for names table
863 printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, funcalias) \
864 > sysnamesbottom
865 if (compatwrap_ != "" || fbase == funcalias)
866 printf("\t/* %3d */\tNULL, /* %s%s */\n", syscall, \
867 compatwrap_, funcalias) > sysnamesfriendly
868 else
869 printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, \
870 fbase) > sysnamesfriendly
871
872 # output syscall number of header, if appropriate
873 if (type == "STD" || type == "NOARGS" || type == "INDIR" || \
874 type == "NOERR") {
875 # output a prototype, to be used to generate lint stubs in
876 # libc.
877 printproto("")
878 } else if (type == "COMPAT" || type == "EXTERN") {
879 # Just define the syscall number with a comment. These
880 # may be used by compatibility stubs in libc.
881 printproto(compatwrap_)
882 }
883
884 # output syscall argument structure, if it has arguments
885 if (argc != 0) {
886 printf("\n") > sysarghdr
887 if (haverumpcalls && !rumpable)
888 printf("#ifndef RUMP_CLIENT\n") > sysarghdr
889 printf("struct %s%s_args", compatwrap_, funcname) > sysarghdr
890 if (type != "NOARGS") {
891 print " {" >sysarghdr;
892 for (i = 1; i <= argc; i++)
893 printf("\tsyscallarg(%s) %s;\n", argtype[i],
894 argname[i]) > sysarghdr
895 printf "}" >sysarghdr;
896 }
897 printf(";\n") > sysarghdr
898 if (type != "NOARGS" && type != "INDIR") {
899 printf("check_syscall_args(%s%s)\n", compatwrap_,
900 funcname) >sysarghdr
901 }
902 if (haverumpcalls && !rumpable)
903 printf("#endif /* !RUMP_CLIENT */\n") > sysarghdr
904 }
905
906 if (!rumpable) {
907 if (funcname == "sys_pipe" && rumphaspipe == 1) {
908 insysent = 1
909 printrumpsysmap(syscall,
910 funcname, funcalias, "rump_sys_pipe")
911 } else {
912 insysent = 0
913 }
914 } else {
915 insysent = 1
916 }
917 printrumpsysent(insysent, compatwrap)
918
919 # output rump marshalling code if necessary
920 if (!rumpable) {
921 return
922 }
923
924 printrumpsysmap(syscall, wfn, funcalias, "rump___sysimpl_" rumpfname)
925
926 printf("\n") > rumpcalls
927
928 if (compatwrap)
929 printf("#ifdef RUMP_SYS_COMPAT\n") > rumpcalls
930
931 # need a local prototype, we export the re-re-named one in .h
932 printf("%s rump___sysimpl_%s(", returntype, rumpfname) \
933 > rumpcalls
934 for (i = 1; i < argc; i++) {
935 if (argname[i] != "PAD")
936 printf("%s, ", uncompattype(argtype[i])) > rumpcalls
937 }
938 printf("%s);", uncompattype(argtype[argc])) > rumpcalls
939
940 printf("\n%s\nrump___sysimpl_%s(", returntype, rumpfname) > rumpcalls
941 for (i = 1; i < argc; i++) {
942 if (argname[i] != "PAD")
943 printf("%s %s, ", uncompattype(argtype[i]), \
944 argname[i]) > rumpcalls
945 }
946 printf("%s %s)\n", uncompattype(argtype[argc]), argname[argc]) \
947 > rumpcalls
948 printf("{\n\tregister_t retval[2];\n") > rumpcalls
949 if (returntype != "void") {
950 if (type != "NOERR") {
951 printf("\tint error = 0;\n") > rumpcalls
952 }
953 # assume rumpcalls return only integral types
954 printf("\t%s rv = -1;\n", returntype) > rumpcalls
955 }
956
957 argarg = "NULL"
958 argsize = 0;
959 if (argc) {
960 argarg = "&callarg"
961 argsize = "sizeof(callarg)"
962 printf("\tstruct %s%s_args callarg;\n\n",compatwrap_,funcname) \
963 > rumpcalls
964 printf "\tmemset(&callarg, 0, sizeof(callarg));\n" > rumpcalls
965 for (i = 1; i <= argc; i++) {
966 if (argname[i] == "PAD") {
967 printf("\tSPARG(&callarg, %s) = 0;\n", \
968 argname[i]) > rumpcalls
969 } else {
970 if (iscompattype(argtype[i])) {
971 printf("\tSPARG(&callarg, %s) = " \
972 "(%s)%s;\n", argname[i], argtype[i], \
973 argname[i]) > rumpcalls
974 } else {
975 printf("\tSPARG(&callarg, %s) = %s;\n",\
976 argname[i], argname[i]) > rumpcalls
977 }
978 }
979 }
980 printf("\n") > rumpcalls
981 } else {
982 printf("\n") > rumpcalls
983 }
984 printf("\t") > rumpcalls
985 if (returntype != "void" && type != "NOERR")
986 printf("error = ") > rumpcalls
987 printf("rsys_syscall(%s%s%s, " \
988 "%s, %s, retval);\n", constprefix, compatwrap_, funcalias, \
989 argarg, argsize) > rumpcalls
990 if (type != "NOERR") {
991 printf("\trsys_seterrno(error);\n") > rumpcalls
992 printf("\tif (error == 0) {\n") > rumpcalls
993 indent="\t\t"
994 ending="\t}\n"
995 } else {
996 indent="\t"
997 ending=""
998 }
999 if (returntype != "void") {
1000 printf("%sif (sizeof(%s) > sizeof(register_t))\n", \
1001 indent, returntype) > rumpcalls
1002 printf("%s\trv = *(%s *)retval;\n", \
1003 indent, returntype) > rumpcalls
1004 printf("%selse\n", indent, indent) > rumpcalls
1005 printf("%s\trv = *retval;\n", indent, returntype) > rumpcalls
1006 printf("%s", ending) > rumpcalls
1007 printf("\treturn rv;\n") > rumpcalls
1008 }
1009 printf("}\n") > rumpcalls
1010
1011 printf("#ifdef RUMP_KERNEL_IS_LIBC\n") > rumpcalls
1012
1013 # create the bog-standard, non-renamed public name.
1014 # this way we get e.g. select instead of just __select50
1015 if (fcompat)
1016 printf("__weak_alias(%s,rump___sysimpl_%s);\n", \
1017 fbase, rumpfname) > rumpcalls
1018
1019 printf("__weak_alias(%s,rump___sysimpl_%s);\n", \
1020 funcalias, rumpfname) > rumpcalls
1021 printf("__weak_alias(_%s,rump___sysimpl_%s);\n", \
1022 funcalias, rumpfname) > rumpcalls
1023 printf("__strong_alias(_sys_%s,rump___sysimpl_%s);\n", \
1024 funcalias, rumpfname) >rumpcalls
1025
1026 printf("#endif /* RUMP_KERNEL_IS_LIBC */\n") > rumpcalls
1027
1028 if (compatwrap)
1029 printf("#endif /* RUMP_SYS_COMPAT */\n") > rumpcalls
1030
1031 }
1032 $2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" \
1033 || $2 == "NOERR" {
1034 parseline()
1035 putent($2, "")
1036 syscall++
1037 next
1038 }
1039 $2 == "OBSOL" || $2 == "UNIMPL" || $2 == "EXCL" || $2 == "IGNORED" {
1040 if ($2 == "OBSOL")
1041 comment="obsolete"
1042 else if ($2 == "EXCL")
1043 comment="excluded"
1044 else if ($2 == "IGNORED")
1045 comment="ignored"
1046 else
1047 comment="unimplemented"
1048 for (i = 3; i <= NF; i++)
1049 comment=comment " " $i
1050
1051 if ($2 == "IGNORED")
1052 sys_stub = "(sy_call_t *)nullop";
1053 else
1054 sys_stub = sys_nosys;
1055
1056 print fillerpsysent(syscall, "", sys_stub, comment) > sysent
1057 print fillerpsysent(syscall, rumpnoflags, rumpnosys, comment) > rumpsysent
1058 printf("\t/* %3d */\t\"#%d (%s)\",\n", syscall, syscall, comment) \
1059 > sysnamesbottom
1060 printf("\t/* %3d */\tNULL, /* %s */\n", syscall, comment) \
1061 > sysnamesfriendly
1062 if ($2 != "UNIMPL")
1063 printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr
1064 syscall++
1065 next
1066 }
1067 $2 == "EXTERN" {
1068 parseline()
1069 putent("EXTERN", "")
1070 syscall++
1071 next
1072 }
1073 {
1074 for (i = 1; i <= ncompat; i++) {
1075 if ($2 == compat_upper[i]) {
1076 parseline();
1077 putent("COMPAT", compat[i])
1078 syscall++
1079 next
1080 }
1081 }
1082 printf("%s: line %d: unrecognized keyword %s\n", infile, NR, $2)
1083 exit 1
1084 }
1085 END {
1086 # output pipe() syscall with its special retval[2] handling
1087 if (rumphaspipe) {
1088 printf("int rump_sys_pipe(int *);\n") > rumpprotos
1089 printf("\nint rump_sys_pipe(int *);\n") > rumpcalls
1090 printf("int\nrump_sys_pipe(int *fd)\n{\n") > rumpcalls
1091 printf("\tregister_t retval[2];\n") > rumpcalls
1092 printf("\tint error = 0;\n") > rumpcalls
1093 printf("\n\terror = rsys_syscall(SYS_pipe, ") > rumpcalls
1094 printf("NULL, 0, retval);\n") > rumpcalls
1095 printf("\tif (error) {\n") > rumpcalls
1096 printf("\t\trsys_seterrno(error);\n") > rumpcalls
1097 printf("\t} else {\n\t\tfd[0] = retval[0];\n") > rumpcalls
1098 printf("\t\tfd[1] = retval[1];\n\t}\n") > rumpcalls
1099 printf("\treturn error ? -1 : 0;\n}\n") > rumpcalls
1100 printf("#ifdef RUMP_KERNEL_IS_LIBC\n") > rumpcalls
1101 printf("__weak_alias(pipe,rump_sys_pipe);\n") > rumpcalls
1102 printf("__weak_alias(_pipe,rump_sys_pipe);\n") > rumpcalls
1103 printf("__strong_alias(_sys_pipe,rump_sys_pipe);\n") > rumpcalls
1104 printf("#endif\n") > rumpcalls
1105 }
1106
1107 # print default rump syscall interfaces
1108 for (var in funcseen) {
1109 printf("#ifndef RUMP_SYS_RENAME_%s\n", \
1110 toupper(var)) > rumpcallshdr
1111 printf("#define RUMP_SYS_RENAME_%s rump___sysimpl_%s\n", \
1112 toupper(var), funcseen[var]) > rumpcallshdr
1113 printf("#endif\n\n") > rumpcallshdr
1114 }
1115
1116 maxsyscall = syscall
1117 if (nsysent) {
1118 if (syscall > nsysent) {
1119 printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)
1120 exit 1
1121 }
1122 while (syscall < nsysent) {
1123 print fillerpsysent(syscall, "", sys_nosys, "filler") > sysent
1124 print fillerpsysent(syscall, rumpnoflags, rumpnosys, "filler") > rumpsysent
1125 printf("\t/* %3d */\t\"# filler\",\n", syscall) \
1126 > sysnamesbottom
1127 printf("\t/* %3d */\tNULL, /* filler */\n", syscall) \
1128 > sysnamesfriendly
1129 syscall++
1130 }
1131 }
1132 printf("};\n") > sysent
1133 printf("};\n") > rumpsysent
1134 printf("CTASSERT(__arraycount(rump_sysent) == SYS_NSYSENT);\n") > rumpsysent
1135 printf("__strong_alias(rumpns_sysent,rump_sysent);\n") > rumpsysent
1136 printf("#endif /* RUMP_CLIENT */\n") > rumpsysent
1137 if (haverumpcalls)
1138 printf("#endif /* !RUMP_CLIENT */\n") > sysprotos
1139 printf("};\n") > sysnamesbottom
1140 printf("};\n") > sysnamesfriendly
1141 printf("#define\t%sMAXSYSCALL\t%d\n", constprefix, maxsyscall) > sysnumhdr
1142 if (nsysent)
1143 printf("#define\t%sNSYSENT\t%d\n", constprefix, nsysent) > sysnumhdr
1144 printf "\tdefault:\n\t\t*n_args = 0;\n\t\tbreak;\n\t};\n}\n" > systrace
1145 printf "\tdefault:\n\t\tbreak;\n\t};\n\tif (p != NULL)\n\t\tstrlcpy(desc, p, descsz);\n}\n" > systracetmp
1146 printf "\tdefault:\n\t\tbreak;\n\t};\n\tif (p != NULL)\n\t\tstrlcpy(desc, p, descsz);\n}\n" > systraceret
1147 } '
1148
1149 cat $sysprotos >> $sysarghdr
1150 echo "#endif /* _${constprefix}SYSCALL_H_ */" >> $sysnumhdr
1151 echo "#endif /* _${constprefix}SYSCALLARGS_H_ */" >> $sysarghdr
1152 echo "};" >> $sysautoload
1153 printf "\n#endif /* _RUMP_RUMP_SYSCALLS_H_ */\n" >> $rumpprotos
1154 cat $sysdcl $sysent > $syssw
1155 cat $sysnamesbottom >> $sysnames
1156 cat $sysnamesfriendly >> $sysnames
1157 cat $rumpsysent >> $rumpcalls
1158
1159 touch $rumptypes
1160 cat $rumptypes >> $rumpcallshdr
1161 echo >> $rumpcallshdr
1162 cat $rumpprotos >> $rumpcallshdr
1163
1164 #chmod 444 $sysnames $sysnumhdr $syssw
1165
1166 cat $systracetmp >> $systrace
1167 cat $systraceret >> $systrace
1168
1169 echo Generated following files:
1170 echo $sysarghdr $sysnumhdr $syssw $sysnames $sysautoload $systrace $rumpcalls $rumpcallshdr $rumpsysmap
1171