Emit prototypes for system call functions and append them to the
`syscallargs' header file.
This commit is contained in:
parent
c9a13fa080
commit
70bf3eea21
|
@ -1,5 +1,5 @@
|
|||
#! /bin/sh -
|
||||
# $NetBSD: makesyscalls.sh,v 1.15 1995/04/22 19:43:02 christos Exp $
|
||||
# $NetBSD: makesyscalls.sh,v 1.16 1995/09/19 21:28:56 thorpej Exp $
|
||||
#
|
||||
# Copyright (c) 1994 Christopher G. Demetriou
|
||||
# All rights reserved.
|
||||
|
@ -58,6 +58,7 @@ esac
|
|||
|
||||
# tmp files:
|
||||
sysdcl="sysent.dcl"
|
||||
sysprotos="sys.protos"
|
||||
syscompat_pref="sysent."
|
||||
sysent="sysent.switch"
|
||||
|
||||
|
@ -66,7 +67,7 @@ for file in $compatopts; do
|
|||
syscompat_files="$syscompat_files $syscompat_pref$file"
|
||||
done
|
||||
|
||||
trap "rm $sysdcl $syscompat_files $sysent" 0
|
||||
trap "rm $sysdcl $sysprotos $syscompat_files $sysent" 0
|
||||
|
||||
# Awk program (must support nawk extensions)
|
||||
# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
|
||||
|
@ -113,6 +114,7 @@ s/\$//g
|
|||
$toupper
|
||||
BEGIN {
|
||||
sysnames = \"$sysnames\"
|
||||
sysprotos = \"$sysprotos\"
|
||||
sysnumhdr = \"$sysnumhdr\"
|
||||
sysarghdr = \"$sysarghdr\"
|
||||
switchname = \"$switchname\"
|
||||
|
@ -143,6 +145,8 @@ BEGIN {
|
|||
printf "/*\n * System call names.\n *\n" > sysnames
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
|
||||
|
||||
printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos
|
||||
|
||||
printf "/*\n * System call numbers.\n *\n" > sysnumhdr
|
||||
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
|
||||
|
||||
|
@ -174,7 +178,7 @@ $1 ~ /^#[ ]*include/ {
|
|||
}
|
||||
$1 ~ /^#[ ]*if/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > sysprotos
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
|
@ -183,7 +187,7 @@ $1 ~ /^#[ ]*if/ {
|
|||
}
|
||||
$1 ~ /^#[ ]*else/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > sysprotos
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
|
@ -192,7 +196,7 @@ $1 ~ /^#[ ]*else/ {
|
|||
}
|
||||
$1 ~ /^#/ {
|
||||
print > sysent
|
||||
print > sysdcl
|
||||
print > sysprotos
|
||||
for (i = 1; i <= ncompat; i++)
|
||||
print > compat_file[i]
|
||||
print > sysnames
|
||||
|
@ -269,10 +273,11 @@ function parseline() {
|
|||
}
|
||||
function putent(nodefs, declfile, compatwrap) {
|
||||
# output syscall declaration for switch table
|
||||
prototype = "__P((struct proc *, void *, register_t *))"
|
||||
if (compatwrap == "")
|
||||
printf("int\t%s();\n", funcname) > declfile
|
||||
printf("int\t%s\t%s;\n", funcname, prototype) > declfile
|
||||
else
|
||||
printf("int\t%s(%s)();\n", compatwrap, funcname) > declfile
|
||||
printf("int\t%s(%s)\t%s;\n", compatwrap, funcname, prototype) > declfile
|
||||
|
||||
# output syscall switch entry
|
||||
# printf("\t{ { %d", argc) > sysent
|
||||
|
@ -334,13 +339,13 @@ function putent(nodefs, declfile, compatwrap) {
|
|||
}
|
||||
$2 == "STD" {
|
||||
parseline()
|
||||
putent("", sysdcl, "")
|
||||
putent("", sysprotos, "");
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
$2 == "NODEF" || $2 == "NOARGS" {
|
||||
parseline()
|
||||
putent($2, sysdcl, "")
|
||||
putent($2, sysprotos, "")
|
||||
syscall++
|
||||
next
|
||||
}
|
||||
|
@ -388,6 +393,7 @@ END {
|
|||
printf("#define\t%sMAXSYSCALL\t%d\n", constprefix, syscall) > sysnumhdr
|
||||
} '
|
||||
|
||||
cat $sysdcl $syscompat_files $sysent > $syssw
|
||||
cat $sysprotos $syscompat_files >> $sysarghdr
|
||||
cat $sysdcl $sysent > $syssw
|
||||
|
||||
#chmod 444 $sysnames $sysnumhdr $syssw
|
||||
|
|
Loading…
Reference in New Issue