makesyscalls.sh revision 1.63.6.1 1 #! /bin/sh -
2 # $NetBSD: makesyscalls.sh,v 1.63.6.1 2008/04/03 12:43:03 mjf Exp $
3 #
4 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. All advertising materials mentioning features or use of this software
16 # must display the following acknowledgement:
17 # This product includes software developed for the NetBSD Project
18 # by Christopher G. Demetriou.
19 # 4. The name of the author may not be used to endorse or promote products
20 # derived from this software without specific prior written permission
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 # @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
34
35 set -e
36
37 case $# in
38 2) ;;
39 *) echo "Usage: $0 config-file input-file" 1>&2
40 exit 1
41 ;;
42 esac
43
44 # the config file sets the following variables:
45 # sysalign check for alignment of off_t
46 # sysnames the syscall names file
47 # sysnumhdr the syscall numbers file
48 # syssw the syscall switch 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 rumpcalls="/dev/null"
66 rumpcallshdr="/dev/null"
67 . ./$1
68
69 # tmp files:
70 sysdcl="sysent.dcl"
71 sysprotos="sys.protos"
72 syscompat_pref="sysent."
73 sysent="sysent.switch"
74 sysnamesbottom="sysnames.bottom"
75
76 trap "rm $sysdcl $sysprotos $sysent $sysnamesbottom" 0
77
78 # Awk program (must support nawk extensions)
79 # Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
80 awk=${AWK:-awk}
81
82 # Does this awk have a "toupper" function?
83 have_toupper=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
84
85 # If this awk does not define "toupper" then define our own.
86 if [ "$have_toupper" = TRUE ] ; then
87 # Used awk (GNU awk or nawk) provides it
88 toupper=
89 else
90 # Provide our own toupper()
91 toupper='
92 function toupper(str) {
93 _toupper_cmd = "echo "str" |tr a-z A-Z"
94 _toupper_cmd | getline _toupper_str;
95 close(_toupper_cmd);
96 return _toupper_str;
97 }'
98 fi
99
100 # before handing it off to awk, make a few adjustments:
101 # (1) insert spaces around {, }, (, ), *, and commas.
102 # (2) get rid of any and all dollar signs (so that rcs id use safe)
103 #
104 # The awk script will deal with blank lines and lines that
105 # start with the comment character (';').
106
107 sed -e '
108 s/\$//g
109 :join
110 /\\$/{a\
111
112 N
113 s/\\\n//
114 b join
115 }
116 2,${
117 /^#/!s/\([{}()*,]\)/ \1 /g
118 }
119 ' < $2 | $awk "
120 $toupper
121 BEGIN {
122 # to allow nested #if/#else/#endif sets
123 savedepth = 0
124 # to track already processed syscalls
125
126 sysnames = \"$sysnames\"
127 sysprotos = \"$sysprotos\"
128 sysnumhdr = \"$sysnumhdr\"
129 sysarghdr = \"$sysarghdr\"
130 rumpcalls = \"$rumpcalls\"
131 rumpcallshdr = \"$rumpcallshdr\"
132 switchname = \"$switchname\"
133 namesname = \"$namesname\"
134 constprefix = \"$constprefix\"
135 registertype = \"$registertype\"
136 sysalign=\"$sysalign\"
137 if (!registertype) {
138 registertype = \"register_t\"
139 }
140 nsysent = \"$nsysent\"
141
142 sysdcl = \"$sysdcl\"
143 syscompat_pref = \"$syscompat_pref\"
144 sysent = \"$sysent\"
145 sysnamesbottom = \"$sysnamesbottom\"
146 sys_nosys = \"$sys_nosys\"
147 maxsysargs = \"$maxsysargs\"
148 infile = \"$2\"
149
150 compatopts = \"$compatopts\"
151 "'
152
153 printf "/* \$NetBSD\$ */\n\n" > sysdcl
154 printf "/*\n * System call switch table.\n *\n" > sysdcl
155 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
156
157 ncompat = split(compatopts,compat)
158 for (i = 1; i <= ncompat; i++) {
159 compat_upper[i] = toupper(compat[i])
160
161 printf "\n#ifdef %s\n", compat_upper[i] > sysent
162 printf "#define %s(func) __CONCAT(%s_,func)\n", compat[i], \
163 compat[i] > sysent
164 printf "#else\n" > sysent
165 printf "#define %s(func) %s\n", compat[i], sys_nosys > sysent
166 printf "#endif\n" > sysent
167 }
168
169 printf "\n#define\ts(type)\tsizeof(type)\n" > sysent
170 printf "#define\tn(type)\t(sizeof(type)/sizeof (%s))\n", registertype > sysent
171 printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > sysent
172 printf "struct sysent %s[] = {\n",switchname > sysent
173
174 printf "/* \$NetBSD\$ */\n\n" > sysnames
175 printf "/*\n * System call names.\n *\n" > sysnames
176 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
177
178 printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos
179
180 printf "/* \$NetBSD\$ */\n\n" > sysnumhdr
181 printf "/*\n * System call numbers.\n *\n" > sysnumhdr
182 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
183
184 printf "/* \$NetBSD\$ */\n\n" > sysarghdr
185 printf "/*\n * System call argument lists.\n *\n" > sysarghdr
186 printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr
187
188 printf "/* \$NetBSD\$ */\n\n" > rumpcalls
189 printf "/*\n * System call marshalling for rump.\n *\n" > rumpcalls
190 printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcalls
191
192 printf "/* \$NetBSD\$ */\n\n" > rumpcallshdr
193 printf "/*\n * System call protos in rump namespace.\n *\n" > rumpcallshdr
194 printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcallshdr
195 }
196 NR == 1 {
197 sub(/ $/, "")
198 printf " * created from%s\n */\n\n", $0 > sysdcl
199 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > sysdcl
200
201 printf " * created from%s\n */\n\n", $0 > sysnames
202 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > sysnames
203
204 printf " * created from%s\n */\n\n", $0 > rumpcalls
205 printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"\$NetBSD\$\");\n\n" > rumpcalls
206 printf "#include <sys/types.h>\n" > rumpcalls
207 printf "#include <sys/param.h>\n" > rumpcalls
208 printf "#include <sys/proc.h>\n" > rumpcalls
209 printf "#include <sys/syscallargs.h>\n" > rumpcalls
210 printf "#include \"rump_syscalls.h\"\n\n" > rumpcalls
211 printf "#if\tBYTE_ORDER == BIG_ENDIAN\n" > rumpcalls
212 printf "#define SPARG(p,k)\t((p)->k.be.datum)\n" > rumpcalls
213 printf "#else /* LITTLE_ENDIAN, I hope dearly */\n" > rumpcalls
214 printf "#define SPARG(p,k)\t((p)->k.le.datum)\n" > rumpcalls
215 printf "#endif\n\n" > rumpcalls
216
217 # System call names are included by userland (kdump(1)), so
218 # hide the include files from it.
219 printf "#if defined(_KERNEL_OPT)\n" > sysnames
220
221 printf "#endif /* _KERNEL_OPT */\n\n" > sysnamesbottom
222 printf "const char *const %s[] = {\n",namesname > sysnamesbottom
223
224 printf " * created from%s\n */\n\n", $0 > sysnumhdr
225
226 printf " * created from%s\n */\n\n", $0 > sysarghdr
227
228 printf " * created from%s\n */\n\n", $0 > rumpcallshdr
229
230 printf "#ifndef _" constprefix "SYSCALL_H_\n" > sysnumhdr
231 printf "#define _" constprefix "SYSCALL_H_\n\n" > sysnumhdr
232 printf "#ifndef _" constprefix "SYSCALLARGS_H_\n" > sysarghdr
233 printf "#define _" constprefix "SYSCALLARGS_H_\n\n" > sysarghdr
234 # Write max number of system call arguments to both headers
235 printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
236 > sysnumhdr
237 printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
238 > sysarghdr
239 printf "#undef\tsyscallarg\n" > sysarghdr
240 printf "#define\tsyscallarg(x)\t\t\t\t\t\t\t\\\n" > sysarghdr
241 printf "\tunion {\t\t\t\t\t\t\t\t\\\n" > sysarghdr
242 printf "\t\t%s pad;\t\t\t\t\t\t\\\n", registertype > sysarghdr
243 printf "\t\tstruct { x datum; } le;\t\t\t\t\t\\\n" > sysarghdr
244 printf "\t\tstruct { /* LINTED zero array dimension */\t\t\\\n" \
245 > sysarghdr
246 printf "\t\t\tint8_t pad[ /* CONSTCOND */\t\t\t\\\n" > sysarghdr
247 printf "\t\t\t\t(sizeof (%s) < sizeof (x))\t\\\n", \
248 registertype > sysarghdr
249 printf "\t\t\t\t? 0\t\t\t\t\t\\\n" > sysarghdr
250 printf "\t\t\t\t: sizeof (%s) - sizeof (x)];\t\\\n", \
251 registertype > sysarghdr
252 printf "\t\t\tx datum;\t\t\t\t\t\\\n" > sysarghdr
253 printf "\t\t} be;\t\t\t\t\t\t\t\\\n" > sysarghdr
254 printf "\t}\n" > sysarghdr
255 printf("\n#undef check_syscall_args\n") >sysarghdr
256 printf("#define check_syscall_args(call) \\\n" \
257 "\ttypedef char call##_check_args" \
258 "[sizeof (struct call##_args) \\\n" \
259 "\t\t<= %sMAXSYSARGS * sizeof (%s) ? 1 : -1];\n", \
260 constprefix, registertype) >sysarghdr
261 next
262 }
263 NF == 0 || $1 ~ /^;/ {
264 next
265 }
266 $0 ~ /^%%$/ {
267 intable = 1
268 next
269 }
270 $1 ~ /^#[ ]*include/ {
271 print > sysdcl
272 print > sysnames
273 next
274 }
275 $1 ~ /^#/ && !intable {
276 print > sysdcl
277 print > sysnames
278 next
279 }
280 $1 ~ /^#/ && intable {
281 if ($1 ~ /^#[ ]*if/) {
282 savedepth++
283 savesyscall[savedepth] = syscall
284 }
285 if ($1 ~ /^#[ ]*else/) {
286 if (savedepth <= 0) {
287 printf("%s: line %d: unbalanced #else\n", \
288 infile, NR)
289 exit 1
290 }
291 syscall = savesyscall[savedepth]
292 }
293 if ($1 ~ /^#[ ]*endif/) {
294 if (savedepth <= 0) {
295 printf("%s: line %d: unbalanced #endif\n", \
296 infile, NR)
297 exit 1
298 }
299 savedepth--
300 }
301 print > sysent
302 print > sysarghdr
303 print > sysnumhdr
304 print > sysprotos
305 print > sysnamesbottom
306 next
307 }
308 syscall != $1 {
309 printf "%s: line %d: syscall number out of sync at %d\n", \
310 infile, NR, syscall
311 printf "line is:\n"
312 print
313 exit 1
314 }
315 function parserr(was, wanted) {
316 printf "%s: line %d: unexpected %s (expected %s)\n", \
317 infile, NR, was, wanted
318 printf "line is:\n"
319 print
320 exit 1
321 }
322 function parseline() {
323 f=3 # toss number and type
324 if ($2 == "INDIR")
325 sycall_flags="SYCALL_INDIRECT"
326 else
327 sycall_flags="0"
328 if ($NF != "}") {
329 funcalias=$NF
330 end=NF-1
331 } else {
332 funcalias=""
333 end=NF
334 }
335 if ($f == "INDIR") { # allow for "NOARG INDIR"
336 sycall_flags = "SYCALL_INDIRECT | " sycall_flags
337 f++
338 }
339 if ($f == "MPSAFE") { # allow for MP-safe syscalls
340 sycall_flags = "SYCALL_MPSAFE | " sycall_flags
341 f++
342 }
343 if ($f == "RUMP") {
344 rumpable = 1
345 f++
346 } else {
347 rumpable = 0
348 }
349 if ($f ~ /^[a-z0-9_]*$/) { # allow syscall alias
350 funcalias=$f
351 f++
352 }
353 if ($f != "{")
354 parserr($f, "{")
355 f++
356 if ($end != "}")
357 parserr($end, "}")
358 end--
359 if ($end != ";")
360 parserr($end, ";")
361 end--
362 if ($end != ")")
363 parserr($end, ")")
364 end--
365
366 returntype = oldf = "";
367 do {
368 if (returntype != "" && oldf != "*")
369 returntype = returntype" ";
370 returntype = returntype$f;
371 oldf = $f;
372 f++
373 } while (f < (end - 1) && $(f+1) != "(");
374 if (f == (end - 1)) {
375 parserr($f, "function argument definition (maybe \"(\"?)");
376 }
377
378 funcname=$f
379 if (funcalias == "") {
380 funcalias=funcname
381 sub(/^([^_]+_)*sys_/, "", funcalias)
382 }
383 f++
384
385 if ($f != "(")
386 parserr($f, ")")
387 f++
388
389 argc=0;
390 argalign=0;
391 if (f == end) {
392 if ($f != "void")
393 parserr($f, "argument definition")
394 isvarargs = 0;
395 varargc = 0;
396 return
397 }
398
399 # some system calls (open() and fcntl()) can accept a variable
400 # number of arguments. If syscalls accept a variable number of
401 # arguments, they must still have arguments specified for
402 # the remaining argument "positions," because of the way the
403 # kernel system call argument handling works.
404 #
405 # Indirect system calls, e.g. syscall(), are exceptions to this
406 # rule, since they are handled entirely by machine-dependent code
407 # and do not need argument structures built.
408
409 isvarargs = 0;
410 while (f <= end) {
411 if ($f == "...") {
412 f++;
413 isvarargs = 1;
414 varargc = argc;
415 continue;
416 }
417 argc++
418 argtype[argc]=""
419 oldf=""
420 while (f < end && $(f+1) != ",") {
421 if (argtype[argc] != "" && oldf != "*")
422 argtype[argc] = argtype[argc]" ";
423 argtype[argc] = argtype[argc]$f;
424 oldf = $f;
425 f++
426 }
427 if (argtype[argc] == "")
428 parserr($f, "argument definition")
429 if (argtype[argc] == "off_t") {
430 if ((argalign % 2) != 0 && sysalign &&
431 funcname != "sys_posix_fadvise") # XXX for now
432 parserr($f, "a padding argument")
433 } else {
434 argalign++;
435 }
436 argname[argc]=$f;
437 f += 2; # skip name, and any comma
438 }
439 # must see another argument after varargs notice.
440 if (isvarargs) {
441 if (argc == varargc)
442 parserr($f, "argument definition")
443 } else
444 varargc = argc;
445 }
446
447 function printproto(wrap) {
448 printf("/* syscall: \"%s%s\" ret: \"%s\" args:", wrap, funcalias,
449 returntype) > sysnumhdr
450 for (i = 1; i <= varargc; i++)
451 printf(" \"%s\"", argtype[i]) > sysnumhdr
452 if (isvarargs)
453 printf(" \"...\"") > sysnumhdr
454 printf(" */\n") > sysnumhdr
455 printf("#define\t%s%s%s\t%d\n\n", constprefix, wrap, funcalias,
456 syscall) > sysnumhdr
457
458 # rumpalooza
459 if (!rumpable)
460 return
461
462 if (wrap == "")
463 wrap = "sys"
464 printf("%s rump_%s_%s(", returntype, wrap, funcalias) > rumpcallshdr
465 for (i = 1; i <= argc; i++)
466 printf("%s, ", argtype[i]) > rumpcallshdr
467 printf("int *);\n") > rumpcallshdr
468 }
469
470 function putent(type, compatwrap) {
471 # output syscall declaration for switch table.
472 if (compatwrap == "")
473 compatwrap_ = ""
474 else
475 compatwrap_ = compatwrap "_"
476 if (argc == 0)
477 arg_type = "void";
478 else {
479 arg_type = "struct " compatwrap_ funcname "_args";
480 }
481 proto = "int\t" compatwrap_ funcname "(struct lwp *, const " \
482 arg_type " *, register_t *);\n"
483 if (sysmap[proto] != 1) {
484 sysmap[proto] = 1;
485 print proto > sysprotos;
486 }
487
488 # output syscall switch entry
489 printf("\t{ ") > sysent
490 if (argc == 0) {
491 printf("0, 0, ") > sysent
492 } else {
493 printf("ns(struct %s%s_args), ", compatwrap_, funcname) > sysent
494 }
495 if (compatwrap == "")
496 wfn = "(sy_call_t *)" funcname;
497 else
498 wfn = "(sy_call_t *)" compatwrap "(" funcname ")";
499 printf("%s,\n\t %s },", sycall_flags, wfn) > sysent
500 for (i = 0; i < (33 - length(wfn)) / 8; i++)
501 printf("\t") > sysent
502 printf("/* %d = %s%s */\n", syscall, compatwrap_, funcalias) > sysent
503
504 # output syscall name for names table
505 printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, funcalias) \
506 > sysnamesbottom
507
508 # output syscall number of header, if appropriate
509 if (type == "STD" || type == "NOARGS" || type == "INDIR") {
510 # output a prototype, to be used to generate lint stubs in
511 # libc.
512 printproto("")
513 } else if (type == "COMPAT") {
514 # Just define the syscall number with a comment. These
515 # may be used by compatibility stubs in libc.
516 printproto(compatwrap_)
517 }
518
519 # output syscall argument structure, if it has arguments
520 if (argc != 0) {
521 printf("\nstruct %s%s_args", compatwrap_, funcname) > sysarghdr
522 if (type != "NOARGS") {
523 print " {" >sysarghdr;
524 for (i = 1; i <= argc; i++)
525 printf("\tsyscallarg(%s) %s;\n", argtype[i],
526 argname[i]) > sysarghdr
527 printf "}" >sysarghdr;
528 }
529 printf(";\n") > sysarghdr
530 if (type != "NOARGS" && type != "INDIR") {
531 printf("check_syscall_args(%s%s)\n", compatwrap_,
532 funcname) >sysarghdr
533 }
534 }
535
536 # output rump marshalling code if necessary
537 if (!rumpable)
538 return
539
540 printf("%s\nrump_%s(", returntype, funcname) > rumpcalls
541 for (i = 1; i <= argc; i++) {
542 printf("%s %s, ", argtype[i], argname[i]) > rumpcalls
543 }
544 printf("int *error)\n") > rumpcalls
545 printf("{\n\tregister_t retval;\n") > rumpcalls
546 argarg = "NULL"
547 if (argc) {
548 argarg = "&arg"
549 printf("\tstruct %s%s_args arg;\n\n", funcname, compatwrap_) \
550 > rumpcalls
551 for (i = 1; i <= argc; i++) {
552 printf("\tSPARG(&arg, %s) = %s;\n", \
553 argname[i], argname[i]) > rumpcalls
554 }
555 printf("\n") > rumpcalls
556 } else {
557 printf("\n") > rumpcalls
558 }
559 printf("\t*error = %s(curlwp, %s, &retval);\n", funcname, argarg) \
560 > rumpcalls
561 if (returntype != "void")
562 printf("\treturn retval;\n") > rumpcalls
563 printf("}\n\n") > rumpcalls
564 }
565 $2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" {
566 parseline()
567 putent($2, "")
568 syscall++
569 next
570 }
571 $2 == "OBSOL" || $2 == "UNIMPL" || $2 == "EXCL" || $2 == "IGNORED" {
572 if ($2 == "OBSOL")
573 comment="obsolete"
574 else if ($2 == "EXCL")
575 comment="excluded"
576 else if ($2 == "IGNORED")
577 comment="ignored"
578 else
579 comment="unimplemented"
580 for (i = 3; i <= NF; i++)
581 comment=comment " " $i
582
583 if ($2 == "IGNORED")
584 sys_stub = "(sy_call_t *)nullop";
585 else
586 sys_stub = sys_nosys;
587
588 printf("\t{ 0, 0, 0,\n\t %s },\t\t\t/* %d = %s */\n", \
589 sys_stub, syscall, comment) > sysent
590 printf("\t/* %3d */\t\"#%d (%s)\",\n", syscall, syscall, comment) \
591 > sysnamesbottom
592 if ($2 != "UNIMPL")
593 printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr
594 syscall++
595 next
596 }
597 {
598 for (i = 1; i <= ncompat; i++) {
599 if ($2 == compat_upper[i]) {
600 parseline();
601 putent("COMPAT", compat[i])
602 syscall++
603 next
604 }
605 }
606 printf("%s: line %d: unrecognized keyword %s\n", infile, NR, $2)
607 exit 1
608 }
609 END {
610 maxsyscall = syscall
611 if (nsysent) {
612 if (syscall > nsysent) {
613 printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)
614 exit 1
615 }
616 while (syscall < nsysent) {
617 printf("\t{ 0, 0, 0,\n\t %s },\t\t\t/* %d = filler */\n", \
618 sys_nosys, syscall) > sysent
619 syscall++
620 }
621 }
622 printf("};\n\n") > sysent
623 printf("};\n") > sysnamesbottom
624 printf("#define\t%sMAXSYSCALL\t%d\n", constprefix, maxsyscall) > sysnumhdr
625 if (nsysent)
626 printf("#define\t%sNSYSENT\t%d\n", constprefix, nsysent) > sysnumhdr
627 } '
628
629 cat $sysprotos >> $sysarghdr
630 echo "#endif /* _${constprefix}SYSCALL_H_ */" >> $sysnumhdr
631 echo "#endif /* _${constprefix}SYSCALLARGS_H_ */" >> $sysarghdr
632 cat $sysdcl $sysent > $syssw
633 cat $sysnamesbottom >> $sysnames
634
635 #chmod 444 $sysnames $sysnumhdr $syssw
636