Introduce syscall.master option 'COMPAT4' which allows one to wrap
syscalls for FreeBSD 4 compatibility. Add kernel option COMPAT_FREEBSD4 to enable these syscalls.
This commit is contained in:
parent
576e9cfb99
commit
482e3b64c1
@ -43,6 +43,7 @@ options CD9660 #ISO 9660 Filesystem
|
||||
options PROCFS #Process filesystem (requires PSEUDOFS)
|
||||
options PSEUDOFS #Pseudo-filesystem framework
|
||||
options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!]
|
||||
options COMPAT_FREEBSD4 #Compatible with FreeBSD4
|
||||
options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI
|
||||
options KTRACE #ktrace(1) support
|
||||
options SYSVSHM #SYSV-style shared memory
|
||||
|
@ -66,6 +66,7 @@ GEOM opt_geom.h
|
||||
|
||||
ADAPTIVE_MUTEXES
|
||||
COMPAT_43 opt_compat.h
|
||||
COMPAT_FREEBSD4 opt_compat.h
|
||||
COMPAT_SUNOS opt_compat.h
|
||||
COMPILING_LINT opt_global.h
|
||||
CY_PCI_FASTINTR
|
||||
|
@ -43,6 +43,7 @@ options CD9660 #ISO 9660 Filesystem
|
||||
options PROCFS #Process filesystem (requires PSEUDOFS)
|
||||
options PSEUDOFS #Pseudo-filesystem framework
|
||||
options COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!]
|
||||
options COMPAT_FREEBSD4 #Compatible with FreeBSD4
|
||||
options SCSI_DELAY=15000 #Delay (in ms) before probing SCSI
|
||||
options KTRACE #ktrace(1) support
|
||||
options SYSVSHM #SYSV-style shared memory
|
||||
|
@ -874,6 +874,9 @@ options COMPAT_LINUX
|
||||
# and PSEUDOFS)
|
||||
options LINPROCFS
|
||||
|
||||
# Enable FreeBSD4 compatibility syscalls
|
||||
options COMPAT_FREEBSD4
|
||||
|
||||
#
|
||||
# SysVR4 ABI emulation
|
||||
#
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user