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