Add support for COMPAT6 syscalls.

Also, change the visibility of compat syscalls a slightly.  Compat
syscalls were missing from 'syscalls.h' entirely.  This additionally adds
them with their compat prefix.  eg: SYS_freebsd6_mmap.

Also, the syscalls.c names strings have different prefixes to differentiate
syscalls. Instead of several "old.mmap" strings, there will now be a
"compat.mmap" and "compat6.mmap" etc.  Before, both would have had the
same "old.mmap" label.

Approved by:  re
This commit is contained in:
Peter Wemm 2007-07-04 22:38:28 +00:00
parent fd95457102
commit 9f0482e515

View File

@ -7,6 +7,7 @@ set -e
# name of compat options:
compat=COMPAT_43
compat4=COMPAT_FREEBSD4
compat6=COMPAT_FREEBSD6
# output files:
sysnames="syscalls.c"
@ -27,14 +28,16 @@ syscompat="sysent.compat.$$"
syscompatdcl="sysent.compatdcl.$$"
syscompat4="sysent.compat4.$$"
syscompat4dcl="sysent.compat4dcl.$$"
syscompat6="sysent.compat6.$$"
syscompat6dcl="sysent.compat6dcl.$$"
sysent="sysent.switch.$$"
sysinc="sysinc.switch.$$"
sysarg="sysarg.switch.$$"
sysprotoend="sysprotoend.$$"
trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $sysent $sysinc $sysarg $sysprotoend" 0
trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $sysent $sysinc $sysarg $sysprotoend" 0
touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $sysent $sysinc $sysarg $sysprotoend
touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $sysent $sysinc $sysarg $sysprotoend
case $# in
0) echo "usage: $0 input-file <config-file>" 1>&2
@ -69,6 +72,8 @@ s/\$//g
syscompatdcl = \"$syscompatdcl\"
syscompat4 = \"$syscompat4\"
syscompat4dcl = \"$syscompat4dcl\"
syscompat6 = \"$syscompat6\"
syscompat6dcl = \"$syscompat6dcl\"
sysent = \"$sysent\"
syssw = \"$syssw\"
sysinc = \"$sysinc\"
@ -79,6 +84,7 @@ s/\$//g
systrace = \"$systrace\"
compat = \"$compat\"
compat4 = \"$compat4\"
compat6 = \"$compat6\"
syscallprefix = \"$syscallprefix\"
switchname = \"$switchname\"
namesname = \"$namesname\"
@ -95,6 +101,7 @@ s/\$//g
printf "\n#ifdef %s\n\n", compat > syscompat
printf "\n#ifdef %s\n\n", compat4 > syscompat4
printf "\n#ifdef %s\n\n", compat6 > syscompat6
printf "/*\n * System call names.\n *\n" > sysnames
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
@ -167,6 +174,7 @@ s/\$//g
print > sysarg
print > syscompat
print > syscompat4
print > syscompat6
print > sysnames
savesyscall = syscall
next
@ -177,6 +185,7 @@ s/\$//g
print > sysarg
print > syscompat
print > syscompat4
print > syscompat6
print > sysnames
syscall = savesyscall
next
@ -187,6 +196,7 @@ s/\$//g
print > sysarg
print > syscompat
print > syscompat4
print > syscompat6
print > sysnames
next
}
@ -255,6 +265,8 @@ s/\$//g
argalias = "o" argalias
if ($3 == "COMPAT4")
argalias = "freebsd4_" argalias
if ($3 == "COMPAT6")
argalias = "freebsd6_" argalias
}
f++
@ -377,7 +389,7 @@ s/\$//g
syscall++
next
}
$3 == "COMPAT" || $3 == "COMPAT4" || $3 == "CPT_NOA" {
$3 == "COMPAT" || $3 == "COMPAT4" || $3 == "COMPAT6" || $3 == "CPT_NOA" {
if ($3 == "COMPAT" || $3 == "CPT_NOA") {
ncompat++
out = syscompat
@ -390,6 +402,12 @@ s/\$//g
outdcl = syscompat4dcl
wrap = "compat4"
prefix = "freebsd4_"
} else if ($3 == "COMPAT6") {
ncompat6++
out = syscompat6
outdcl = syscompat6dcl
wrap = "compat6"
prefix = "freebsd6_"
}
parseline()
if (argc != 0 && $3 != "CPT_NOA") {
@ -412,10 +430,16 @@ s/\$//g
align_sysent_comment(8 + 9 + \
length(argssize) + 1 + length(funcname) + length(auditev) + 4)
printf("/* %d = old %s */\n", syscall, funcalias) > sysent
printf("\t\"old.%s\",\t\t/* %d = old %s */\n",
funcalias, syscall, funcalias) > sysnames
printf("\t\t\t\t/* %d is old %s */\n",
syscall, funcalias) > syshdr
printf("\t\"%s.%s\",\t\t/* %d = old %s */\n",
wrap, funcalias, syscall, funcalias) > sysnames
if ($3 == "COMPAT" || $3 == "CPT_NOA") {
printf("\t\t\t\t/* %d is old %s */\n",
syscall, funcalias) > syshdr
} else {
printf("#define\t%s%s%s\t%d\n", syscallprefix,
prefix, funcalias, syscall) > syshdr
printf(" \\\n\t%s%s.o", prefix, funcalias) > sysmk
}
syscall++
next
}
@ -462,7 +486,7 @@ s/\$//g
END {
printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc
if (ncompat != 0 || ncompat4 != 0)
if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0)
printf "#include \"opt_compat.h\"\n\n" > syssw
printf "#include \<bsm/audit_kevents.h\>\n" > syssw
@ -482,9 +506,17 @@ s/\$//g
printf "#endif\n" > sysinc
}
printf("\n#endif /* %s */\n\n", compat) > syscompatdcl
if (ncompat6 != 0) {
printf "\n#ifdef %s\n", compat6 > sysinc
printf "#define compat6(n, name) n, (sy_call_t *)__CONCAT(freebsd6_,name)\n" > sysinc
printf "#else\n" > sysinc
printf "#define compat6(n, name) 0, (sy_call_t *)nosys\n" > sysinc
printf "#endif\n" > sysinc
}
printf("\n#endif /* %s */\n\n", compat) > syscompatdcl
printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl
printf("\n#endif /* %s */\n\n", compat6) > syscompat6dcl
printf("\n#undef PAD_\n") > sysprotoend
printf("#undef PADL_\n") > sysprotoend
@ -503,5 +535,6 @@ cat $sysinc $sysent >> $syssw
cat $sysarg $sysdcl \
$syscompat $syscompatdcl \
$syscompat4 $syscompat4dcl \
$syscompat6 $syscompat6dcl \
$sysaue $sysprotoend > $sysproto