summaryrefslogtreecommitdiffstats
path: root/sys/kern/makesyscalls.sh
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-19 13:31:04 +0000
committerbde <bde@FreeBSD.org>1995-09-19 13:31:04 +0000
commitad23d1b01eef119d48c0cb43e8624662e0900cdc (patch)
tree609526e4a0d39688a81b25c000f674c78f2e4501 /sys/kern/makesyscalls.sh
parent2c8d5766d6d44155fd334a8c6dc1bfdbaec12d70 (diff)
downloadFreeBSD-src-ad23d1b01eef119d48c0cb43e8624662e0900cdc.zip
FreeBSD-src-ad23d1b01eef119d48c0cb43e8624662e0900cdc.tar.gz
Generate prototypes for syscall-implementing functions. Put them in
<sys/sysproto.h> and use them (so far only) in kern/init_sysent.c. Don't put $Id in generated files. kern/syscalls.master: I had to add some new fields to describe some non-orthogonal names. E.g., the args struct for the syscall-implementing function foo() is usually named `foo_args', but for getpid() it is named `args'. sys/sysent.h: sy_call_t is still incomplete to hide a couple of warnings.
Diffstat (limited to 'sys/kern/makesyscalls.sh')
-rw-r--r--sys/kern/makesyscalls.sh80
1 files changed, 55 insertions, 25 deletions
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh
index abe49ba..ba27763 100644
--- a/sys/kern/makesyscalls.sh
+++ b/sys/kern/makesyscalls.sh
@@ -1,6 +1,6 @@
#! /bin/sh -
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
-# $Id: makesyscalls.sh,v 1.11 1995/02/14 19:22:29 sos Exp $
+# $Id: makesyscalls.sh,v 1.12 1995/03/16 18:12:39 bde Exp $
set -e
@@ -9,6 +9,8 @@ compat=COMPAT_43
# output files:
sysnames="syscalls.c"
+sysproto="../sys/sysproto.h"
+sysproto_h=_SYS_SYSPROTO_H_
syshdr="../sys/syscall.h"
syssw="init_sysent.c"
syshide="../sys/syscall-hide.h"
@@ -29,6 +31,8 @@ esac
awk < $1 "
BEGIN {
sysdcl = \"$sysdcl\"
+ sysproto = \"$sysproto\"
+ sysproto_h = \"$sysproto_h\"
syscompat = \"$syscompat\"
sysent = \"$sysent\"
sysnames = \"$sysnames\"
@@ -38,11 +42,13 @@ awk < $1 "
infile = \"$1\"
"'
- printf "/*\n * System call switch table.\n *\n" > sysdcl
+ printf "/*\n * System call switch table.\n *\n" > sysent
+ printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysent
+
+ printf "/*\n * System call prototypes.\n *\n" > sysdcl
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
- printf "\n#ifdef %s\n", compat > syscompat
- printf "#define compat(n, name) n, __CONCAT(o,name)\n\n" > syscompat
+ printf "\n#ifdef %s\n\n", compat > syscompat
printf "/*\n * System call names.\n *\n" > sysnames
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
@@ -53,12 +59,26 @@ awk < $1 "
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshide
}
NR == 1 {
- printf " * created from%s\n */\n\n", $0 > sysdcl
- printf "#include <sys/param.h>\n" > sysdcl
- printf "#include <sys/sysent.h>\n\n" > sysdcl
-
+ gsub("\\$Id: ", "", $0)
+ gsub(" \\$", "", $0)
+ printf " * created from%s\n */\n\n", $0 > sysent
+ printf "#include <sys/param.h>\n" > sysent
+ printf "#include <sys/sysent.h>\n" > sysent
+ printf "#include <sys/sysproto.h>\n\n" > sysent
+ printf "#ifdef %s\n", compat > sysent
+ printf "#define compat(n, name) n, (sy_call_t *)__CONCAT(o,name)\n" > sysent
+ printf("#else\n") > sysent
+ printf("#define compat(n, name) 0, (sy_call_t *)nosys\n") > sysent
+ printf("#endif\n\n") > sysent
+ printf("/* The casts are bogus but will do for now. */\n") > sysent
printf "struct sysent sysent[] = {\n" > sysent
+ printf " * created from%s\n */\n\n", $0 > sysdcl
+ printf("#ifndef %s\n", sysproto_h) > sysdcl
+ printf("#define\t%s\n\n", sysproto_h) > sysdcl
+ printf "#include <sys/types.h>\n\n", $0 > sysdcl
+ printf "struct proc;\n\n", $0 > sysdcl
+
printf " * created from%s\n */\n\n", $0 > sysnames
printf "char *syscallnames[] = {\n" > sysnames
@@ -104,22 +124,33 @@ awk < $1 "
exit 1
}
{ comment = $5
- for (i = 6; i <= NF; i++)
- comment = comment " " $i
- if (NF < 6)
+ if (NF < 8)
+ for (i = 6; i <= NF; i++)
+ comment = comment " " $i
+ if (NF < 6) {
$6 = $5
+ $7 = $5 "_args"
+ if ($2 == "COMPAT")
+ $7 = "o" $7
+ $8 = "int"
+ }
if ($4 != "NOHIDE")
printf("HIDE_%s(%s)\n", $4, $5) > syshide
}
$2 == "STD" || $2 == "NODEF" {
if (( !nosys || $5 != "nosys" ) && ( !lkmnosys ||
- $5 != "lkmnosys"))
- printf("int\t%s();\n", $5) > sysdcl
+ $5 != "lkmnosys")) {
+ printf("struct\t%s;\n", $7) > sysdcl
+ if ($5 == "exit")
+ printf("__dead ") > sysdcl
+ printf("%s\t%s __P((struct proc *, struct %s *, int []));\n", \
+ $8, $5, $7) > sysdcl
+ }
if ($5 == "nosys")
nosys = 1
if ($5 == "lkmnosys")
lkmnosys = 1
- printf("\t{ %d, %s },\t\t\t/* %d = %s */\n", \
+ printf("\t{ %d, (sy_call_t *)%s },\t\t\t/* %d = %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"%s\",\t\t\t/* %d = %s */\n", \
$6, syscall, $6) > sysnames
@@ -130,7 +161,9 @@ awk < $1 "
next
}
$2 == "COMPAT" {
- printf("int\to%s();\n", $5) > syscompat
+ printf("struct\t%s;\n", $7) > syscompat
+ printf("%s\to%s __P((struct proc *, struct %s *, int []));\n", \
+ $8, $5, $7) > syscompat
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
@@ -141,7 +174,7 @@ awk < $1 "
next
}
$2 == "LIBCOMPAT" {
- printf("int\to%s();\n", $5) > syscompat
+ printf("%s\to%s();\n", $8, $5) > syscompat
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
@@ -152,7 +185,7 @@ awk < $1 "
next
}
$2 == "OBSOL" {
- printf("\t{ 0, nosys },\t\t\t/* %d = obsolete %s */\n", \
+ printf("\t{ 0, (sy_call_t *)nosys },\t\t\t/* %d = obsolete %s */\n", \
syscall, comment) > sysent
printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", \
$5, syscall, comment) > sysnames
@@ -162,7 +195,7 @@ awk < $1 "
next
}
$2 == "UNIMPL" {
- printf("\t{ 0, nosys },\t\t\t/* %d = %s */\n", \
+ printf("\t{ 0, (sy_call_t *)nosys },\t\t\t/* %d = %s */\n", \
syscall, comment) > sysent
printf("\t\"#%d\",\t\t\t/* %d = %s */\n", \
syscall, syscall, comment) > sysnames
@@ -174,9 +207,8 @@ awk < $1 "
exit 1
}
END {
- printf("\n#else /* %s */\n", compat) > syscompat
- printf("#define compat(n, name) 0, nosys\n") > syscompat
- printf("#endif /* %s */\n\n", compat) > syscompat
+ printf("\n#endif /* %s */\n", compat) > syscompat
+ printf("\n#endif /* !%s */\n", sysproto_h) > syscompat
printf("};\n\n") > sysent
printf ("struct sysentvec aout_sysvec = {\n") > sysent
@@ -186,7 +218,5 @@ awk < $1 "
printf("};\n") > sysnames
} '
-cat $sysdcl $syscompat $sysent >$syssw
-
-chmod 444 $sysnames $syshdr $syssw $syshide
-
+cat $sysent >$syssw
+cat $sysdcl $syscompat >$sysproto
OpenPOWER on IntegriCloud