summaryrefslogtreecommitdiffstats
path: root/sys/kern/makesyscalls.sh
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-07-12 06:38:34 +0000
committeralfred <alfred@FreeBSD.org>2002-07-12 06:38:34 +0000
commit482e3b64c1d15ab11a302f934114bfe22bfe7cf9 (patch)
tree7e5fed2d740ea0d068950323a19964d503baf05a /sys/kern/makesyscalls.sh
parent576e9cfb992e75213c1ba9a8c7dc8d585402257c (diff)
downloadFreeBSD-src-482e3b64c1d15ab11a302f934114bfe22bfe7cf9.zip
FreeBSD-src-482e3b64c1d15ab11a302f934114bfe22bfe7cf9.tar.gz
Introduce syscall.master option 'COMPAT4' which allows one to wrap
syscalls for FreeBSD 4 compatibility. Add kernel option COMPAT_FREEBSD4 to enable these syscalls.
Diffstat (limited to 'sys/kern/makesyscalls.sh')
-rw-r--r--sys/kern/makesyscalls.sh82
1 files changed, 64 insertions, 18 deletions
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh
index f4a0212..53afdc2 100644
--- a/sys/kern/makesyscalls.sh
+++ b/sys/kern/makesyscalls.sh
@@ -4,8 +4,9 @@
set -e
-# name of compat option:
+# name of compat options:
compat=COMPAT_43
+compat4=COMPAT_FREEBSD4
# output files:
sysnames="syscalls.c"
@@ -22,13 +23,16 @@ namesname="syscallnames"
sysdcl="sysent.dcl.$$"
syscompat="sysent.compat.$$"
syscompatdcl="sysent.compatdcl.$$"
+syscompat4="sysent.compat4.$$"
+syscompat4dcl="sysent.compat4dcl.$$"
sysent="sysent.switch.$$"
sysinc="sysinc.switch.$$"
sysarg="sysarg.switch.$$"
+sysprotoend="sysprotoend.$$"
-trap "rm $sysdcl $syscompat $syscompatdcl $sysent $sysinc $sysarg" 0
+trap "rm $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $sysent $sysinc $sysarg $sysprotoend" 0
-touch $sysdcl $syscompat $syscompatdcl $sysent $sysinc $sysarg
+touch $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $sysent $sysinc $sysarg $sysprotoend
case $# in
0) echo "usage: $0 input-file <config-file>" 1>&2
@@ -56,9 +60,12 @@ s/\$//g
BEGIN {
sysdcl = \"$sysdcl\"
sysproto = \"$sysproto\"
+ sysprotoend = \"$sysprotoend\"
sysproto_h = \"$sysproto_h\"
syscompat = \"$syscompat\"
syscompatdcl = \"$syscompatdcl\"
+ syscompat4 = \"$syscompat4\"
+ syscompat4dcl = \"$syscompat4dcl\"
sysent = \"$sysent\"
syssw = \"$syssw\"
sysinc = \"$sysinc\"
@@ -67,6 +74,7 @@ s/\$//g
syshdr = \"$syshdr\"
sysmk = \"$sysmk\"
compat = \"$compat\"
+ compat4 = \"$compat4\"
syscallprefix = \"$syscallprefix\"
switchname = \"$switchname\"
namesname = \"$namesname\"
@@ -82,6 +90,7 @@ s/\$//g
printf " * $%s$\n", "FreeBSD" > sysarg
printf "\n#ifdef %s\n\n", compat > syscompat
+ printf "\n#ifdef %s\n\n", compat4 > syscompat4
printf "/*\n * System call names.\n *\n" > sysnames
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
@@ -141,6 +150,7 @@ s/\$//g
print > sysdcl
print > sysarg
print > syscompat
+ print > syscompat4
print > sysnames
savesyscall = syscall
next
@@ -150,6 +160,7 @@ s/\$//g
print > sysdcl
print > sysarg
print > syscompat
+ print > syscompat4
print > sysnames
syscall = savesyscall
next
@@ -159,6 +170,7 @@ s/\$//g
print > sysdcl
print > sysarg
print > syscompat
+ print > syscompat4
print > sysnames
next
}
@@ -224,6 +236,8 @@ s/\$//g
argalias = funcname "_args"
if ($2 == "COMPAT")
argalias = "o" argalias
+ if ($2 == "COMPAT4")
+ argalias = "freebsd4_" argalias
}
f++
@@ -280,6 +294,8 @@ s/\$//g
$2 = "NOSTD";
} else if ($2 == "MCOMPAT") {
$2 = "COMPAT";
+ } else if ($2 == "MCOMPAT4") {
+ $2 = "COMPAT4";
} else if ($2 == "MCPT_NOA") {
$2 = "CPT_NOA";
} else if ($2 == "MLIBCOMPAT") {
@@ -348,26 +364,38 @@ s/\$//g
syscall++
next
}
- $2 == "COMPAT" || $2 == "CPT_NOA" {
- ncompat++
+ $2 == "COMPAT" || $2 == "COMPAT4" || $2 == "CPT_NOA" {
+ if ($2 == "COMPAT" || $2 == "CPT_NOA") {
+ ncompat++
+ out = syscompat
+ outdcl = syscompatdcl
+ wrap = "compat"
+ prefix = "o"
+ } else if ($2 == "COMPAT4") {
+ ncompat4++
+ out = syscompat4
+ outdcl = syscompat4dcl
+ wrap = "compat4"
+ prefix = "freebsd4_"
+ }
parseline()
if (argc != 0 && $2 != "CPT_NOA") {
- printf("struct %s {\n", argalias) > syscompat
+ printf("struct %s {\n", argalias) > out
for (i = 1; i <= argc; i++)
printf("\tchar %s_l_[PADL_(%s)]; %s %s; " \
"char %s_r_[PADR_(%s)];\n",
argname[i], argtype[i],
argtype[i], argname[i],
- argname[i], argtype[i]) > syscompat
- printf("};\n") > syscompat
+ argname[i], argtype[i]) > out
+ printf("};\n") > out
}
else if($2 != "CPT_NOA")
printf("struct %s {\n\tregister_t dummy;\n};\n",
argalias) > sysarg
- printf("%s\to%s(struct thread *, struct %s *);\n",
- rettype, funcname, argalias) > syscompatdcl
- printf("\t{ compat(%s%s,%s) },",
- mpsafe, argssize, funcname) > sysent
+ printf("%s\t%s%s(struct thread *, struct %s *);\n",
+ rettype, prefix, funcname, argalias) > outdcl
+ printf("\t{ %s(%s%s,%s) },",
+ wrap, mpsafe, argssize, funcname) > sysent
align_sysent_comment(8 + 9 + length(mpsafe) + \
length(argssize) + 1 + length(funcname) + 4)
printf("/* %d = old %s */\n", syscall, funcalias) > sysent
@@ -420,8 +448,11 @@ s/\$//g
}
END {
printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc
- if (ncompat != 0) {
+
+ if (ncompat != 0 || ncompat4 != 0)
printf "#include \"opt_compat.h\"\n\n" > syssw
+
+ if (ncompat != 0) {
printf "\n#ifdef %s\n", compat > sysinc
printf "#define compat(n, name) n, (sy_call_t *)__CONCAT(o,name)\n" > sysinc
printf "#else\n" > sysinc
@@ -429,11 +460,22 @@ s/\$//g
printf "#endif\n" > sysinc
}
+ if (ncompat4 != 0) {
+ printf "\n#ifdef %s\n", compat4 > sysinc
+ printf "#define compat4(n, name) n, (sy_call_t *)__CONCAT(freebsd4_,name)\n" > sysinc
+ printf "#else\n" > sysinc
+ printf "#define compat4(n, name) 0, (sy_call_t *)nosys\n" > sysinc
+ printf "#endif\n" > sysinc
+ }
+
printf("\n#endif /* %s */\n\n", compat) > syscompatdcl
- printf("#undef PAD_\n") > syscompatdcl
- printf("#undef PADL_\n") > syscompatdcl
- printf("#undef PADR_\n") > syscompatdcl
- printf("\n#endif /* !%s */\n", sysproto_h) > syscompatdcl
+
+ printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl
+
+ printf("#undef PAD_\n") > sysprotoend
+ printf("#undef PADL_\n") > sysprotoend
+ printf("#undef PADR_\n") > sysprotoend
+ printf("\n#endif /* !%s */\n", sysproto_h) > sysprotoend
printf("\n") > sysmk
printf("};\n") > sysent
@@ -443,4 +485,8 @@ s/\$//g
} '
cat $sysinc $sysent >> $syssw
-cat $sysarg $sysdcl $syscompat $syscompatdcl > $sysproto
+cat $sysarg $sysdcl \
+ $syscompat $syscompatdcl \
+ $syscompat4 $syscompat4dcl \
+ $sysprotoend > $sysproto
+
OpenPOWER on IntegriCloud