1993-04-06 14:37:09 +04:00
|
|
|
#! /bin/sh -
|
2010-12-30 23:09:53 +03:00
|
|
|
# $NetBSD: makesyscalls.sh,v 1.108 2010/12/30 20:09:53 pooka Exp $
|
1994-06-29 10:29:24 +04:00
|
|
|
#
|
2000-08-18 23:33:30 +04:00
|
|
|
# Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
|
1994-10-20 07:37:09 +03:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# 3. All advertising materials mentioning features or use of this software
|
|
|
|
# must display the following acknowledgement:
|
|
|
|
# This product includes software developed for the NetBSD Project
|
|
|
|
# by Christopher G. Demetriou.
|
|
|
|
# 4. The name of the author may not be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written permission
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1994-10-29 02:14:46 +03:00
|
|
|
|
|
|
|
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
|
1993-04-06 14:37:09 +04:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
case $# in
|
|
|
|
2) ;;
|
|
|
|
*) echo "Usage: $0 config-file input-file" 1>&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# the config file sets the following variables:
|
2008-03-22 18:11:01 +03:00
|
|
|
# sysalign check for alignment of off_t
|
1994-10-20 07:22:35 +03:00
|
|
|
# sysnames the syscall names file
|
|
|
|
# sysnumhdr the syscall numbers file
|
|
|
|
# syssw the syscall switch file
|
|
|
|
# sysarghdr the syscall argument struct definitions
|
|
|
|
# compatopts those syscall types that are for 'compat' syscalls
|
|
|
|
# switchname the name for the 'struct sysent' we define
|
2000-12-09 08:27:08 +03:00
|
|
|
# namesname the name for the 'const char *[]' we define
|
1994-10-20 07:22:35 +03:00
|
|
|
# constprefix the prefix for the system call constants
|
1998-10-03 23:21:11 +04:00
|
|
|
# registertype the type for register_t
|
2000-12-09 08:27:08 +03:00
|
|
|
# nsysent the size of the sysent table
|
2001-03-30 20:56:36 +04:00
|
|
|
# sys_nosys [optional] name of function called for unsupported
|
|
|
|
# syscalls, if not sys_nosys()
|
2007-11-09 17:54:13 +03:00
|
|
|
# maxsysargs [optiona] the maximum number or arguments
|
1994-10-20 07:22:35 +03:00
|
|
|
#
|
2004-07-31 04:55:51 +04:00
|
|
|
# NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'SYSLIBCOMPAT'.
|
1993-04-06 14:37:09 +04:00
|
|
|
|
2001-03-30 20:56:36 +04:00
|
|
|
# source the config file.
|
|
|
|
sys_nosys="sys_nosys" # default is sys_nosys(), if not specified otherwise
|
2007-11-09 17:54:13 +03:00
|
|
|
maxsysargs=8 # default limit is 8 (32bit) arguments
|
2008-03-18 15:36:15 +03:00
|
|
|
rumpcalls="/dev/null"
|
|
|
|
rumpcallshdr="/dev/null"
|
2009-02-20 20:56:36 +03:00
|
|
|
rumpsysent="rumpsysent.tmp"
|
2001-03-30 20:56:36 +04:00
|
|
|
. ./$1
|
|
|
|
|
1993-04-06 14:37:09 +04:00
|
|
|
# tmp files:
|
|
|
|
sysdcl="sysent.dcl"
|
1995-09-20 01:28:56 +04:00
|
|
|
sysprotos="sys.protos"
|
1994-10-20 07:22:35 +03:00
|
|
|
syscompat_pref="sysent."
|
1993-04-06 14:37:09 +04:00
|
|
|
sysent="sysent.switch"
|
1998-02-19 02:14:55 +03:00
|
|
|
sysnamesbottom="sysnames.bottom"
|
1993-04-06 14:37:09 +04:00
|
|
|
|
2009-02-20 20:56:36 +03:00
|
|
|
trap "rm $sysdcl $sysprotos $sysent $sysnamesbottom $rumpsysent" 0
|
1993-04-06 14:37:09 +04:00
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
# Awk program (must support nawk extensions)
|
|
|
|
# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere.
|
|
|
|
awk=${AWK:-awk}
|
1993-04-06 14:37:09 +04:00
|
|
|
|
2004-09-12 15:24:15 +04:00
|
|
|
# Does this awk have a "toupper" function?
|
|
|
|
have_toupper=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null`
|
1993-04-06 14:37:09 +04:00
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
# If this awk does not define "toupper" then define our own.
|
2004-09-12 15:24:15 +04:00
|
|
|
if [ "$have_toupper" = TRUE ] ; then
|
|
|
|
# Used awk (GNU awk or nawk) provides it
|
1994-10-20 07:22:35 +03:00
|
|
|
toupper=
|
|
|
|
else
|
|
|
|
# Provide our own toupper()
|
|
|
|
toupper='
|
|
|
|
function toupper(str) {
|
|
|
|
_toupper_cmd = "echo "str" |tr a-z A-Z"
|
|
|
|
_toupper_cmd | getline _toupper_str;
|
|
|
|
close(_toupper_cmd);
|
|
|
|
return _toupper_str;
|
|
|
|
}'
|
|
|
|
fi
|
1993-04-06 14:37:09 +04:00
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
# before handing it off to awk, make a few adjustments:
|
|
|
|
# (1) insert spaces around {, }, (, ), *, and commas.
|
|
|
|
# (2) get rid of any and all dollar signs (so that rcs id use safe)
|
|
|
|
#
|
|
|
|
# The awk script will deal with blank lines and lines that
|
|
|
|
# start with the comment character (';').
|
|
|
|
|
|
|
|
sed -e '
|
|
|
|
s/\$//g
|
|
|
|
:join
|
|
|
|
/\\$/{a\
|
|
|
|
|
|
|
|
N
|
|
|
|
s/\\\n//
|
|
|
|
b join
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
2,${
|
2009-01-14 01:27:43 +03:00
|
|
|
/^#/!s/\([{}()*,|]\)/ \1 /g
|
1994-10-20 07:22:35 +03:00
|
|
|
}
|
|
|
|
' < $2 | $awk "
|
|
|
|
$toupper
|
|
|
|
BEGIN {
|
2008-07-24 01:17:25 +04:00
|
|
|
# Create a NetBSD tag that does not get expanded when checking
|
|
|
|
# this script out of CVS. (This part of the awk script is in a
|
|
|
|
# shell double-quoted string, so the backslashes are eaten by
|
|
|
|
# the shell.)
|
|
|
|
tag = \"\$\" \"NetBSD\" \"\$\"
|
|
|
|
|
1996-03-15 04:25:12 +03:00
|
|
|
# to allow nested #if/#else/#endif sets
|
|
|
|
savedepth = 0
|
2001-01-01 19:41:43 +03:00
|
|
|
# to track already processed syscalls
|
1996-03-15 04:25:12 +03:00
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
sysnames = \"$sysnames\"
|
1995-09-20 01:28:56 +04:00
|
|
|
sysprotos = \"$sysprotos\"
|
1994-10-20 07:22:35 +03:00
|
|
|
sysnumhdr = \"$sysnumhdr\"
|
|
|
|
sysarghdr = \"$sysarghdr\"
|
2010-03-02 22:33:12 +03:00
|
|
|
sysarghdrextra = \"$sysarghdrextra\"
|
2008-03-12 01:50:10 +03:00
|
|
|
rumpcalls = \"$rumpcalls\"
|
|
|
|
rumpcallshdr = \"$rumpcallshdr\"
|
2009-02-20 20:56:36 +03:00
|
|
|
rumpsysent = \"$rumpsysent\"
|
1994-10-20 07:22:35 +03:00
|
|
|
switchname = \"$switchname\"
|
|
|
|
namesname = \"$namesname\"
|
|
|
|
constprefix = \"$constprefix\"
|
1998-10-03 23:21:11 +04:00
|
|
|
registertype = \"$registertype\"
|
2008-03-22 18:11:01 +03:00
|
|
|
sysalign=\"$sysalign\"
|
1998-10-03 23:21:11 +04:00
|
|
|
if (!registertype) {
|
|
|
|
registertype = \"register_t\"
|
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
nsysent = \"$nsysent\"
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
sysdcl = \"$sysdcl\"
|
|
|
|
syscompat_pref = \"$syscompat_pref\"
|
|
|
|
sysent = \"$sysent\"
|
1998-02-19 02:14:55 +03:00
|
|
|
sysnamesbottom = \"$sysnamesbottom\"
|
2001-03-30 20:56:36 +04:00
|
|
|
sys_nosys = \"$sys_nosys\"
|
2007-11-09 17:54:13 +03:00
|
|
|
maxsysargs = \"$maxsysargs\"
|
1994-10-20 07:22:35 +03:00
|
|
|
infile = \"$2\"
|
|
|
|
|
|
|
|
compatopts = \"$compatopts\"
|
|
|
|
"'
|
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > sysdcl
|
1994-10-20 07:22:35 +03:00
|
|
|
printf "/*\n * System call switch table.\n *\n" > sysdcl
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
|
|
|
|
|
|
|
|
ncompat = split(compatopts,compat)
|
|
|
|
for (i = 1; i <= ncompat; i++) {
|
|
|
|
compat_upper[i] = toupper(compat[i])
|
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
printf "\n#ifdef %s\n", compat_upper[i] > sysent
|
2001-04-27 10:07:27 +04:00
|
|
|
printf "#define %s(func) __CONCAT(%s_,func)\n", compat[i], \
|
1995-10-07 09:25:19 +03:00
|
|
|
compat[i] > sysent
|
|
|
|
printf "#else\n" > sysent
|
2001-04-27 10:07:27 +04:00
|
|
|
printf "#define %s(func) %s\n", compat[i], sys_nosys > sysent
|
1995-10-07 09:25:19 +03:00
|
|
|
printf "#endif\n" > sysent
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
|
2007-11-09 17:54:13 +03:00
|
|
|
printf "\n#define\ts(type)\tsizeof(type)\n" > sysent
|
|
|
|
printf "#define\tn(type)\t(sizeof(type)/sizeof (%s))\n", registertype > sysent
|
|
|
|
printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > sysent
|
1995-10-07 09:25:19 +03:00
|
|
|
printf "struct sysent %s[] = {\n",switchname > sysent
|
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > sysnames
|
1994-10-20 07:22:35 +03:00
|
|
|
printf "/*\n * System call names.\n *\n" > sysnames
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
|
|
|
|
|
1995-09-20 01:28:56 +04:00
|
|
|
printf "\n/*\n * System call prototypes.\n */\n\n" > sysprotos
|
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > sysnumhdr
|
1994-10-20 07:22:35 +03:00
|
|
|
printf "/*\n * System call numbers.\n *\n" > sysnumhdr
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr
|
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > sysarghdr
|
1994-10-21 02:22:38 +03:00
|
|
|
printf "/*\n * System call argument lists.\n *\n" > sysarghdr
|
1994-10-20 07:22:35 +03:00
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr
|
2008-03-12 01:50:10 +03:00
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > rumpcalls
|
2009-02-20 20:56:36 +03:00
|
|
|
printf "/*\n * System call vector and marshalling for rump.\n *\n" > rumpcalls
|
2008-03-12 01:50:10 +03:00
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcalls
|
|
|
|
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "/* %s */\n\n", tag > rumpcallshdr
|
2008-03-12 01:50:10 +03:00
|
|
|
printf "/*\n * System call protos in rump namespace.\n *\n" > rumpcallshdr
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > rumpcallshdr
|
1994-10-20 07:22:35 +03:00
|
|
|
}
|
|
|
|
NR == 1 {
|
2005-02-27 02:32:31 +03:00
|
|
|
sub(/ $/, "")
|
1994-10-20 07:22:35 +03:00
|
|
|
printf " * created from%s\n */\n\n", $0 > sysdcl
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysdcl
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
printf " * created from%s\n */\n\n", $0 > sysnames
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > sysnames
|
1998-02-19 06:30:24 +03:00
|
|
|
|
2008-03-12 01:50:10 +03:00
|
|
|
printf " * created from%s\n */\n\n", $0 > rumpcalls
|
2008-07-24 01:17:25 +04:00
|
|
|
printf "#include <sys/cdefs.h>\n__KERNEL_RCSID(0, \"%s\");\n\n", tag > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
|
2008-03-12 01:50:10 +03:00
|
|
|
printf "#include <sys/param.h>\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "#include <sys/fstypes.h>\n" > rumpcalls
|
2008-03-12 01:50:10 +03:00
|
|
|
printf "#include <sys/proc.h>\n" > rumpcalls
|
2009-02-20 20:56:36 +03:00
|
|
|
printf "#include <sys/syscall.h>\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "#include <sys/syscallargs.h>\n\n" > rumpcalls
|
|
|
|
printf "#ifdef RUMP_CLIENT\n" > rumpcalls
|
|
|
|
printf "#include <errno.h>\n" > rumpcalls
|
|
|
|
printf "#include <rump/rumpclient.h>\n\n" > rumpcalls
|
|
|
|
printf "#define rsys_syscall(num, data, dlen, retval)\t\\\n" > rumpcalls
|
|
|
|
printf " rumpclient_syscall(num, data, dlen, retval)\n" > rumpcalls
|
|
|
|
printf "#define rsys_seterrno(error) errno = error\n" > rumpcalls
|
|
|
|
printf "#define rsys_alias(a,b)\n#else\n" > rumpcalls
|
2010-11-18 00:47:11 +03:00
|
|
|
printf "#include <sys/syscallvar.h>\n\n" > rumpcalls
|
2009-01-23 22:27:18 +03:00
|
|
|
printf "#include <rump/rumpuser.h>\n" > rumpcalls
|
2008-10-13 20:25:12 +04:00
|
|
|
printf "#include \"rump_private.h\"\n\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "static int\nrsys_syscall" > rumpcalls
|
|
|
|
printf "(int num, void *data, size_t dlen, register_t *retval)" > rumpcalls
|
2010-11-18 00:47:11 +03:00
|
|
|
printf "\n{\n\tstruct sysent *callp = rump_sysent + num;\n" > rumpcalls
|
|
|
|
printf "\tint rv;\n" > rumpcalls
|
|
|
|
printf "\n\tKASSERT(num > 0 && num < SYS_NSYSENT);\n\n" > rumpcalls
|
|
|
|
printf "\trump_schedule();\n" > rumpcalls
|
|
|
|
printf "\trv = sy_call(callp, curlwp, data, retval);\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "\trump_unschedule();\n\n\treturn rv;\n}\n\n" > rumpcalls
|
|
|
|
printf "#define rsys_seterrno(error) rumpuser_seterrno(error)\n" > rumpcalls
|
|
|
|
printf "#define rsys_alias(a,b) __weak_alias(a,b);\n#endif\n\n" > rumpcalls
|
|
|
|
|
2008-03-12 01:50:10 +03:00
|
|
|
printf "#if\tBYTE_ORDER == BIG_ENDIAN\n" > rumpcalls
|
|
|
|
printf "#define SPARG(p,k)\t((p)->k.be.datum)\n" > rumpcalls
|
|
|
|
printf "#else /* LITTLE_ENDIAN, I hope dearly */\n" > rumpcalls
|
|
|
|
printf "#define SPARG(p,k)\t((p)->k.le.datum)\n" > rumpcalls
|
2008-10-13 22:16:33 +04:00
|
|
|
printf "#endif\n\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "#ifndef RUMP_CLIENT\n" > rumpcalls
|
2008-10-13 22:16:33 +04:00
|
|
|
printf "int rump_enosys(void);\n" > rumpcalls
|
|
|
|
printf "int\nrump_enosys()\n{\n\n\treturn ENOSYS;\n}\n" > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "#endif\n" > rumpcalls
|
2008-03-12 01:50:10 +03:00
|
|
|
|
2010-11-04 23:50:29 +03:00
|
|
|
printf "\n#ifndef RUMP_CLIENT\n" > rumpsysent
|
|
|
|
printf "#define\ts(type)\tsizeof(type)\n" > rumpsysent
|
2009-02-20 20:56:36 +03:00
|
|
|
printf "#define\tn(type)\t(sizeof(type)/sizeof (%s))\n", registertype > rumpsysent
|
|
|
|
printf "#define\tns(type)\tn(type), s(type)\n\n", registertype > rumpsysent
|
|
|
|
printf "struct sysent rump_sysent[] = {\n" > rumpsysent
|
|
|
|
|
1998-02-19 06:30:24 +03:00
|
|
|
# System call names are included by userland (kdump(1)), so
|
|
|
|
# hide the include files from it.
|
2001-05-30 15:27:46 +04:00
|
|
|
printf "#if defined(_KERNEL_OPT)\n" > sysnames
|
1998-02-19 06:30:24 +03:00
|
|
|
|
2001-05-30 15:27:46 +04:00
|
|
|
printf "#endif /* _KERNEL_OPT */\n\n" > sysnamesbottom
|
2000-12-09 08:33:27 +03:00
|
|
|
printf "const char *const %s[] = {\n",namesname > sysnamesbottom
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
printf " * created from%s\n */\n\n", $0 > sysnumhdr
|
2010-05-17 16:35:20 +04:00
|
|
|
printf "#ifndef _" constprefix "SYSCALL_H_\n" > sysnumhdr
|
|
|
|
printf "#define _" constprefix "SYSCALL_H_\n\n" > sysnumhdr
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
printf " * created from%s\n */\n\n", $0 > sysarghdr
|
2010-05-17 16:35:20 +04:00
|
|
|
printf "#ifndef _" constprefix "SYSCALLARGS_H_\n" > sysarghdr
|
|
|
|
printf "#define _" constprefix "SYSCALLARGS_H_\n\n" > sysarghdr
|
2008-03-12 01:50:10 +03:00
|
|
|
|
|
|
|
printf " * created from%s\n */\n\n", $0 > rumpcallshdr
|
2010-05-17 16:35:20 +04:00
|
|
|
printf "#ifndef _RUMP_RUMP_SYSCALLS_H_\n" > rumpcallshdr
|
|
|
|
printf "#define _RUMP_RUMP_SYSCALLS_H_\n\n" > rumpcallshdr
|
2010-05-12 00:09:11 +04:00
|
|
|
printf "#ifdef _KERNEL\n" > rumpcallshdr
|
|
|
|
printf "#error Interface not supported inside kernel\n" > rumpcallshdr
|
|
|
|
printf "#endif /* _KERNEL */\n\n" > rumpcallshdr
|
2009-03-29 11:56:19 +04:00
|
|
|
printf "#include <sys/types.h>\n" > rumpcallshdr
|
|
|
|
printf "#include <sys/select.h>\n\n" > rumpcallshdr
|
|
|
|
printf "#include <signal.h>\n\n" > rumpcallshdr
|
2008-03-12 01:50:10 +03:00
|
|
|
|
2010-03-02 22:33:12 +03:00
|
|
|
printf "%s", sysarghdrextra > sysarghdr
|
2007-11-09 17:54:13 +03:00
|
|
|
# Write max number of system call arguments to both headers
|
|
|
|
printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
|
|
|
|
> sysnumhdr
|
|
|
|
printf("#define\t%sMAXSYSARGS\t%d\n\n", constprefix, maxsysargs) \
|
|
|
|
> sysarghdr
|
1998-10-03 23:21:11 +04:00
|
|
|
printf "#undef\tsyscallarg\n" > sysarghdr
|
1999-08-20 23:07:31 +04:00
|
|
|
printf "#define\tsyscallarg(x)\t\t\t\t\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\tunion {\t\t\t\t\t\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\t\t%s pad;\t\t\t\t\t\t\\\n", registertype > sysarghdr
|
|
|
|
printf "\t\tstruct { x datum; } le;\t\t\t\t\t\\\n" > sysarghdr
|
2001-10-31 00:52:26 +03:00
|
|
|
printf "\t\tstruct { /* LINTED zero array dimension */\t\t\\\n" \
|
|
|
|
> sysarghdr
|
|
|
|
printf "\t\t\tint8_t pad[ /* CONSTCOND */\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\t\t\t\t(sizeof (%s) < sizeof (x))\t\\\n", \
|
1998-10-03 23:21:11 +04:00
|
|
|
registertype > sysarghdr
|
1999-08-20 23:07:31 +04:00
|
|
|
printf "\t\t\t\t? 0\t\t\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\t\t\t\t: sizeof (%s) - sizeof (x)];\t\\\n", \
|
1998-10-03 23:21:11 +04:00
|
|
|
registertype > sysarghdr
|
1999-08-20 23:07:31 +04:00
|
|
|
printf "\t\t\tx datum;\t\t\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\t\t} be;\t\t\t\t\t\t\t\\\n" > sysarghdr
|
|
|
|
printf "\t}\n" > sysarghdr
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("\n#undef check_syscall_args\n") >sysarghdr
|
2010-11-04 20:02:34 +03:00
|
|
|
printf("#define check_syscall_args(call) /*LINTED*/ \\\n" \
|
2007-11-09 17:54:13 +03:00
|
|
|
"\ttypedef char call##_check_args" \
|
|
|
|
"[sizeof (struct call##_args) \\\n" \
|
|
|
|
"\t\t<= %sMAXSYSARGS * sizeof (%s) ? 1 : -1];\n", \
|
|
|
|
constprefix, registertype) >sysarghdr
|
1994-10-20 07:22:35 +03:00
|
|
|
next
|
|
|
|
}
|
|
|
|
NF == 0 || $1 ~ /^;/ {
|
|
|
|
next
|
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
$0 ~ /^%%$/ {
|
|
|
|
intable = 1
|
|
|
|
next
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
$1 ~ /^#[ ]*include/ {
|
|
|
|
print > sysdcl
|
1998-02-19 02:14:55 +03:00
|
|
|
print > sysnames
|
1994-10-20 07:22:35 +03:00
|
|
|
next
|
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
$1 ~ /^#/ && !intable {
|
|
|
|
print > sysdcl
|
|
|
|
print > sysnames
|
1994-10-20 07:22:35 +03:00
|
|
|
next
|
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
$1 ~ /^#/ && intable {
|
|
|
|
if ($1 ~ /^#[ ]*if/) {
|
|
|
|
savedepth++
|
|
|
|
savesyscall[savedepth] = syscall
|
|
|
|
}
|
|
|
|
if ($1 ~ /^#[ ]*else/) {
|
|
|
|
if (savedepth <= 0) {
|
|
|
|
printf("%s: line %d: unbalanced #else\n", \
|
|
|
|
infile, NR)
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
syscall = savesyscall[savedepth]
|
1996-03-15 04:25:12 +03:00
|
|
|
}
|
|
|
|
if ($1 ~ /^#[ ]*endif/) {
|
|
|
|
if (savedepth <= 0) {
|
2000-12-09 08:27:08 +03:00
|
|
|
printf("%s: line %d: unbalanced #endif\n", \
|
|
|
|
infile, NR)
|
1996-03-15 04:25:12 +03:00
|
|
|
exit 1
|
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
savedepth--
|
1996-03-15 04:25:12 +03:00
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
print > sysent
|
2003-09-11 17:59:49 +04:00
|
|
|
print > sysarghdr
|
|
|
|
print > sysnumhdr
|
1995-09-20 01:28:56 +04:00
|
|
|
print > sysprotos
|
1998-02-19 02:14:55 +03:00
|
|
|
print > sysnamesbottom
|
2009-02-20 20:56:36 +03:00
|
|
|
|
|
|
|
# XXX: technically we do not want to have conditionals in rump,
|
|
|
|
# but it is easier to just let the cpp handle them than try to
|
|
|
|
# figure out what we want here in this script
|
|
|
|
print > rumpsysent
|
1994-10-20 07:22:35 +03:00
|
|
|
next
|
|
|
|
}
|
|
|
|
syscall != $1 {
|
|
|
|
printf "%s: line %d: syscall number out of sync at %d\n", \
|
|
|
|
infile, NR, syscall
|
|
|
|
printf "line is:\n"
|
|
|
|
print
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
function parserr(was, wanted) {
|
2009-01-13 19:29:19 +03:00
|
|
|
printf "%s: line %d: unexpected %s (expected <%s>)\n", \
|
1994-10-20 07:22:35 +03:00
|
|
|
infile, NR, was, wanted
|
1999-02-11 12:32:01 +03:00
|
|
|
printf "line is:\n"
|
|
|
|
print
|
1994-10-20 07:22:35 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
function parseline() {
|
|
|
|
f=3 # toss number and type
|
2007-11-09 17:54:13 +03:00
|
|
|
if ($2 == "INDIR")
|
|
|
|
sycall_flags="SYCALL_INDIRECT"
|
|
|
|
else
|
|
|
|
sycall_flags="0"
|
1994-10-20 07:22:35 +03:00
|
|
|
if ($NF != "}") {
|
|
|
|
funcalias=$NF
|
|
|
|
end=NF-1
|
|
|
|
} else {
|
|
|
|
funcalias=""
|
|
|
|
end=NF
|
1994-05-17 04:00:46 +04:00
|
|
|
}
|
2007-11-10 16:22:11 +03:00
|
|
|
if ($f == "INDIR") { # allow for "NOARG INDIR"
|
|
|
|
sycall_flags = "SYCALL_INDIRECT | " sycall_flags
|
|
|
|
f++
|
|
|
|
}
|
2008-11-12 17:29:31 +03:00
|
|
|
if ($f == "MODULAR") { # registered at runtime
|
|
|
|
modular = 1
|
|
|
|
f++
|
|
|
|
} else {
|
|
|
|
modular = 0;
|
|
|
|
}
|
2008-03-12 01:50:10 +03:00
|
|
|
if ($f == "RUMP") {
|
|
|
|
rumpable = 1
|
|
|
|
f++
|
|
|
|
} else {
|
|
|
|
rumpable = 0
|
|
|
|
}
|
2000-12-12 20:32:45 +03:00
|
|
|
if ($f ~ /^[a-z0-9_]*$/) { # allow syscall alias
|
|
|
|
funcalias=$f
|
|
|
|
f++
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
if ($f != "{")
|
|
|
|
parserr($f, "{")
|
|
|
|
f++
|
|
|
|
if ($end != "}")
|
|
|
|
parserr($end, "}")
|
|
|
|
end--
|
|
|
|
if ($end != ";")
|
|
|
|
parserr($end, ";")
|
|
|
|
end--
|
|
|
|
if ($end != ")")
|
|
|
|
parserr($end, ")")
|
|
|
|
end--
|
|
|
|
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
returntype = oldf = "";
|
|
|
|
do {
|
|
|
|
if (returntype != "" && oldf != "*")
|
|
|
|
returntype = returntype" ";
|
|
|
|
returntype = returntype$f;
|
|
|
|
oldf = $f;
|
|
|
|
f++
|
2009-01-14 01:27:43 +03:00
|
|
|
} while ($f != "|" && f < (end-1))
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
if (f == (end - 1)) {
|
2009-01-14 01:27:43 +03:00
|
|
|
parserr($f, "function argument definition (maybe \"|\"?)");
|
|
|
|
}
|
|
|
|
f++
|
|
|
|
|
|
|
|
fprefix=$f
|
|
|
|
f++
|
|
|
|
if ($f != "|") {
|
|
|
|
parserr($f, "function compat delimiter (maybe \"|\"?)");
|
|
|
|
}
|
|
|
|
f++
|
|
|
|
|
|
|
|
fcompat=""
|
|
|
|
if ($f != "|") {
|
|
|
|
fcompat=$f
|
|
|
|
f++
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($f != "|") {
|
|
|
|
parserr($f, "function name delimiter (maybe \"|\"?)");
|
|
|
|
}
|
|
|
|
f++
|
|
|
|
fbase=$f
|
|
|
|
|
2009-11-26 20:19:54 +03:00
|
|
|
# pipe is special in how to returns its values.
|
|
|
|
# So just generate it manually if present.
|
|
|
|
if (rumpable == 1 && fbase == "pipe") {
|
|
|
|
rumpable = 0;
|
|
|
|
rumphaspipe = 1;
|
|
|
|
}
|
|
|
|
|
2009-01-14 01:27:43 +03:00
|
|
|
funcstdname=fprefix "_" fbase
|
|
|
|
if (fcompat != "") {
|
|
|
|
funcname=fprefix "___" fbase "" fcompat
|
|
|
|
wantrename=1
|
|
|
|
} else {
|
|
|
|
funcname=funcstdname
|
|
|
|
wantrename=0
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
}
|
2009-12-13 07:47:45 +03:00
|
|
|
if (returntype == "quad_t" || returntype == "off_t") {
|
|
|
|
if (sycall_flags == "0")
|
|
|
|
sycall_flags = "SYCALL_RET_64";
|
|
|
|
else
|
|
|
|
sycall_flags = "SYCALL_RET_64 | " sycall_flags;
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
if (funcalias == "") {
|
1994-10-20 07:22:35 +03:00
|
|
|
funcalias=funcname
|
1995-10-07 09:25:19 +03:00
|
|
|
sub(/^([^_]+_)*sys_/, "", funcalias)
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
f++
|
|
|
|
|
|
|
|
if ($f != "(")
|
2009-01-13 19:25:43 +03:00
|
|
|
parserr($f, "(")
|
1994-10-20 07:22:35 +03:00
|
|
|
f++
|
|
|
|
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
argc=0;
|
2008-01-28 13:31:37 +03:00
|
|
|
argalign=0;
|
1994-10-20 07:22:35 +03:00
|
|
|
if (f == end) {
|
|
|
|
if ($f != "void")
|
|
|
|
parserr($f, "argument definition")
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
isvarargs = 0;
|
|
|
|
varargc = 0;
|
2009-01-23 22:27:18 +03:00
|
|
|
argtype[0]="void";
|
1994-10-20 07:22:35 +03:00
|
|
|
return
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
# some system calls (open() and fcntl()) can accept a variable
|
|
|
|
# number of arguments. If syscalls accept a variable number of
|
|
|
|
# arguments, they must still have arguments specified for
|
|
|
|
# the remaining argument "positions," because of the way the
|
|
|
|
# kernel system call argument handling works.
|
|
|
|
#
|
|
|
|
# Indirect system calls, e.g. syscall(), are exceptions to this
|
|
|
|
# rule, since they are handled entirely by machine-dependent code
|
|
|
|
# and do not need argument structures built.
|
|
|
|
|
|
|
|
isvarargs = 0;
|
2009-12-13 07:47:45 +03:00
|
|
|
args64 = 0;
|
1994-10-20 07:22:35 +03:00
|
|
|
while (f <= end) {
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
if ($f == "...") {
|
|
|
|
f++;
|
|
|
|
isvarargs = 1;
|
|
|
|
varargc = argc;
|
|
|
|
continue;
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
argc++
|
|
|
|
argtype[argc]=""
|
1994-10-29 02:14:46 +03:00
|
|
|
oldf=""
|
1994-10-20 07:22:35 +03:00
|
|
|
while (f < end && $(f+1) != ",") {
|
1994-10-29 02:14:46 +03:00
|
|
|
if (argtype[argc] != "" && oldf != "*")
|
1994-10-20 07:22:35 +03:00
|
|
|
argtype[argc] = argtype[argc]" ";
|
|
|
|
argtype[argc] = argtype[argc]$f;
|
1994-10-29 02:14:46 +03:00
|
|
|
oldf = $f;
|
1994-10-20 07:22:35 +03:00
|
|
|
f++
|
|
|
|
}
|
|
|
|
if (argtype[argc] == "")
|
|
|
|
parserr($f, "argument definition")
|
2009-05-15 18:52:47 +04:00
|
|
|
if (argtype[argc] == "off_t" \
|
|
|
|
|| argtype[argc] == "dev_t" \
|
|
|
|
|| argtype[argc] == "time_t") {
|
2008-03-22 18:11:01 +03:00
|
|
|
if ((argalign % 2) != 0 && sysalign &&
|
2008-01-28 13:31:37 +03:00
|
|
|
funcname != "sys_posix_fadvise") # XXX for now
|
|
|
|
parserr($f, "a padding argument")
|
|
|
|
} else {
|
|
|
|
argalign++;
|
|
|
|
}
|
2010-01-05 18:23:32 +03:00
|
|
|
if (argtype[argc] == "quad_t" || argtype[argc] == "off_t" \
|
|
|
|
|| argtype[argc] == "dev_t" || argtype[argc] == "time_t") {
|
2009-12-13 07:47:45 +03:00
|
|
|
if (sycall_flags == "0")
|
|
|
|
sycall_flags = "SYCALL_ARG"argc-1"_64";
|
|
|
|
else
|
|
|
|
sycall_flags = "SYCALL_ARG"argc-1"_64 | " sycall_flags;
|
|
|
|
args64++;
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
argname[argc]=$f;
|
|
|
|
f += 2; # skip name, and any comma
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
2009-12-13 07:47:45 +03:00
|
|
|
if (args64 > 0)
|
|
|
|
sycall_flags = "SYCALL_NARGS64_VAL("args64") | " sycall_flags;
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
# must see another argument after varargs notice.
|
|
|
|
if (isvarargs) {
|
2007-11-10 16:22:11 +03:00
|
|
|
if (argc == varargc)
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
parserr($f, "argument definition")
|
|
|
|
} else
|
|
|
|
varargc = argc;
|
1994-10-20 07:22:35 +03:00
|
|
|
}
|
2003-09-11 17:59:49 +04:00
|
|
|
|
|
|
|
function printproto(wrap) {
|
|
|
|
printf("/* syscall: \"%s%s\" ret: \"%s\" args:", wrap, funcalias,
|
|
|
|
returntype) > sysnumhdr
|
|
|
|
for (i = 1; i <= varargc; i++)
|
|
|
|
printf(" \"%s\"", argtype[i]) > sysnumhdr
|
|
|
|
if (isvarargs)
|
|
|
|
printf(" \"...\"") > sysnumhdr
|
|
|
|
printf(" */\n") > sysnumhdr
|
|
|
|
printf("#define\t%s%s%s\t%d\n\n", constprefix, wrap, funcalias,
|
|
|
|
syscall) > sysnumhdr
|
2008-03-12 01:50:10 +03:00
|
|
|
|
|
|
|
# rumpalooza
|
|
|
|
if (!rumpable)
|
|
|
|
return
|
|
|
|
|
2010-08-30 14:24:04 +04:00
|
|
|
if (wantrename)
|
|
|
|
printf("%s rump_%s(", returntype, funcstdname) > rumpcallshdr
|
|
|
|
else
|
|
|
|
printf("%s rump_sys_%s(", returntype, funcalias) > rumpcallshdr
|
2009-10-14 01:54:29 +04:00
|
|
|
for (i = 1; i < varargc; i++)
|
2009-05-15 19:51:27 +04:00
|
|
|
if (argname[i] != "PAD")
|
|
|
|
printf("%s, ", argtype[i]) > rumpcallshdr
|
2009-10-14 01:54:29 +04:00
|
|
|
if (isvarargs)
|
|
|
|
printf("%s, ...)", argtype[varargc]) > rumpcallshdr
|
|
|
|
else
|
|
|
|
printf("%s)", argtype[argc]) > rumpcallshdr
|
2009-01-14 01:27:43 +03:00
|
|
|
if (wantrename)
|
|
|
|
printf(" __RENAME(rump_%s)", funcname) > rumpcallshdr
|
|
|
|
printf(";\n") > rumpcallshdr
|
2003-09-11 17:59:49 +04:00
|
|
|
}
|
|
|
|
|
2009-11-26 20:19:54 +03:00
|
|
|
function printrumpsysent(insysent, compatwrap) {
|
|
|
|
if (!insysent) {
|
2010-04-27 14:57:46 +04:00
|
|
|
eno[0] = "rump_enosys"
|
|
|
|
eno[1] = "sys_nomodule"
|
2010-12-30 19:49:24 +03:00
|
|
|
flags[0] = "SYCALL_NOSYS"
|
|
|
|
flags[1] = "0"
|
|
|
|
printf("\t{ 0, 0, %s,\n\t (sy_call_t *)%s }, \t" \
|
2010-12-30 23:09:53 +03:00
|
|
|
"/* %d = %s */\n", \
|
|
|
|
flags[modular], eno[modular], syscall, funcalias) \
|
|
|
|
> rumpsysent
|
2009-11-26 20:19:54 +03:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\t{ ") > rumpsysent
|
|
|
|
if (argc == 0) {
|
|
|
|
printf("0, 0, ") > rumpsysent
|
|
|
|
} else {
|
2010-08-30 14:24:04 +04:00
|
|
|
printf("ns(struct sys_%s%s_args), ", compatwrap_, funcalias) > rumpsysent
|
2009-11-26 20:19:54 +03:00
|
|
|
}
|
|
|
|
printf("0,\n\t %s },", wfn) > rumpsysent
|
2010-12-30 16:38:10 +03:00
|
|
|
for (i = 0; i < (33 - length(wfn)) / 8; i++)
|
2009-11-26 20:19:54 +03:00
|
|
|
printf("\t") > rumpsysent
|
|
|
|
printf("/* %d = %s%s */\n", syscall, compatwrap_, funcalias) > rumpsysent
|
|
|
|
}
|
|
|
|
|
2007-11-10 16:22:11 +03:00
|
|
|
function putent(type, compatwrap) {
|
2007-11-09 17:54:13 +03:00
|
|
|
# output syscall declaration for switch table.
|
|
|
|
if (compatwrap == "")
|
|
|
|
compatwrap_ = ""
|
|
|
|
else
|
|
|
|
compatwrap_ = compatwrap "_"
|
2007-12-21 02:02:38 +03:00
|
|
|
if (argc == 0)
|
|
|
|
arg_type = "void";
|
|
|
|
else {
|
|
|
|
arg_type = "struct " compatwrap_ funcname "_args";
|
|
|
|
}
|
|
|
|
proto = "int\t" compatwrap_ funcname "(struct lwp *, const " \
|
|
|
|
arg_type " *, register_t *);\n"
|
2007-11-09 17:54:13 +03:00
|
|
|
if (sysmap[proto] != 1) {
|
|
|
|
sysmap[proto] = 1;
|
|
|
|
print proto > sysprotos;
|
1996-12-22 09:45:14 +03:00
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
# output syscall switch entry
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("\t{ ") > sysent
|
|
|
|
if (argc == 0) {
|
|
|
|
printf("0, 0, ") > sysent
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
} else {
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("ns(struct %s%s_args), ", compatwrap_, funcname) > sysent
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
}
|
2008-11-12 17:29:31 +03:00
|
|
|
if (modular)
|
|
|
|
wfn = "(sy_call_t *)sys_nomodule";
|
|
|
|
else if (compatwrap == "")
|
2007-12-21 02:02:38 +03:00
|
|
|
wfn = "(sy_call_t *)" funcname;
|
1994-10-20 07:22:35 +03:00
|
|
|
else
|
2007-12-21 02:02:38 +03:00
|
|
|
wfn = "(sy_call_t *)" compatwrap "(" funcname ")";
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("%s,\n\t %s },", sycall_flags, wfn) > sysent
|
|
|
|
for (i = 0; i < (33 - length(wfn)) / 8; i++)
|
|
|
|
printf("\t") > sysent
|
|
|
|
printf("/* %d = %s%s */\n", syscall, compatwrap_, funcalias) > sysent
|
|
|
|
|
|
|
|
# output syscall name for names table
|
|
|
|
printf("\t/* %3d */\t\"%s%s\",\n", syscall, compatwrap_, funcalias) \
|
|
|
|
> sysnamesbottom
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
# output syscall number of header, if appropriate
|
2007-11-10 16:22:11 +03:00
|
|
|
if (type == "STD" || type == "NOARGS" || type == "INDIR") {
|
* remember (i.e. don't throw away) system call return types.
* Deal with multi-word system call return types (i.e. foo *, or
struct foo *, or struct foo, etc.).
* Add a new class of system calls "INDIR" (for "indirect"), which
is to be used to represent indirect syscalls like syscall() and
__syscall() which are implemented in MD code and which don't want
args structures defined. (The old way of declaring this type of
syscalls still works.)
* Allow system calls to be marked as having a variable number of
arguments, by inserting "..." (no trailing comma) before the
first hf the optional arguments in the syscall definition. Because
of the way syscall arguments are handled by MI code, _ALL_ syscall
arguments must actually be included in the definition, i.e.
"optional" arguments are either "are there or aren't," i.e. these
aren't really varargs functions. Therefore, for normal syscalls,
there _must_ be arguments listed after the "...". For INDIR
syscalls, which really do have a variable number of arguments and
which aren't handled via the normal mechanism, that requirement is
not in force.
* output primitive (machine-parsable) syscall descriptions as comments
in <sys/syscall.h>. These can be used to easily build real function
prototypes, or to build stub functions for use by lint.
1996-12-22 09:33:16 +03:00
|
|
|
# output a prototype, to be used to generate lint stubs in
|
|
|
|
# libc.
|
2003-09-11 17:59:49 +04:00
|
|
|
printproto("")
|
2007-11-10 16:22:11 +03:00
|
|
|
} else if (type == "COMPAT") {
|
1998-09-13 08:57:24 +04:00
|
|
|
# Just define the syscall number with a comment. These
|
|
|
|
# may be used by compatibility stubs in libc.
|
2007-11-09 17:54:13 +03:00
|
|
|
printproto(compatwrap_)
|
|
|
|
}
|
1994-10-20 07:22:35 +03:00
|
|
|
|
|
|
|
# output syscall argument structure, if it has arguments
|
2007-12-21 02:02:38 +03:00
|
|
|
if (argc != 0) {
|
|
|
|
printf("\nstruct %s%s_args", compatwrap_, funcname) > sysarghdr
|
|
|
|
if (type != "NOARGS") {
|
|
|
|
print " {" >sysarghdr;
|
|
|
|
for (i = 1; i <= argc; i++)
|
|
|
|
printf("\tsyscallarg(%s) %s;\n", argtype[i],
|
|
|
|
argname[i]) > sysarghdr
|
|
|
|
printf "}" >sysarghdr;
|
|
|
|
}
|
|
|
|
printf(";\n") > sysarghdr
|
|
|
|
if (type != "NOARGS" && type != "INDIR") {
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("check_syscall_args(%s%s)\n", compatwrap_,
|
|
|
|
funcname) >sysarghdr
|
|
|
|
}
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
2008-03-12 01:50:10 +03:00
|
|
|
|
2009-11-26 20:19:54 +03:00
|
|
|
if (!rumpable) {
|
|
|
|
if (funcname == "sys_pipe" && rumphaspipe == 1)
|
|
|
|
insysent = 1
|
|
|
|
else
|
|
|
|
insysent = 0
|
|
|
|
} else {
|
|
|
|
insysent = 1
|
|
|
|
}
|
|
|
|
printrumpsysent(insysent, compatwrap)
|
|
|
|
|
2008-03-12 01:50:10 +03:00
|
|
|
# output rump marshalling code if necessary
|
2009-02-20 20:56:36 +03:00
|
|
|
if (!rumpable) {
|
2008-03-12 01:50:10 +03:00
|
|
|
return
|
2009-02-20 20:56:36 +03:00
|
|
|
}
|
2008-03-12 01:50:10 +03:00
|
|
|
|
2009-01-14 01:27:43 +03:00
|
|
|
# need a local prototype, we export the re-re-named one in .h
|
2010-08-30 14:24:04 +04:00
|
|
|
printf("\n%s rump_sys_%s(", returntype, funcalias) > rumpcalls
|
2009-01-23 22:27:18 +03:00
|
|
|
for (i = 1; i < argc; i++) {
|
2009-05-15 19:51:27 +04:00
|
|
|
if (argname[i] != "PAD")
|
|
|
|
printf("%s, ", argtype[i]) > rumpcalls
|
2009-01-14 01:27:43 +03:00
|
|
|
}
|
2009-01-23 22:27:18 +03:00
|
|
|
printf("%s);", argtype[argc]) > rumpcalls
|
2009-01-14 01:27:43 +03:00
|
|
|
|
2010-08-30 14:24:04 +04:00
|
|
|
printf("\n%s\nrump_sys_%s(", returntype, funcalias) > rumpcalls
|
2009-01-23 22:27:18 +03:00
|
|
|
for (i = 1; i < argc; i++) {
|
2009-05-15 19:51:27 +04:00
|
|
|
if (argname[i] != "PAD")
|
|
|
|
printf("%s %s, ", argtype[i], argname[i]) > rumpcalls
|
2008-03-12 01:50:10 +03:00
|
|
|
}
|
2009-01-23 22:27:18 +03:00
|
|
|
printf("%s %s)\n", argtype[argc], argname[argc]) > rumpcalls
|
2009-11-26 19:34:24 +03:00
|
|
|
printf("{\n\tregister_t rval[2] = {0, 0};\n\tint error = 0;\n") \
|
|
|
|
> rumpcalls
|
2009-01-14 01:27:43 +03:00
|
|
|
|
2008-03-12 01:50:10 +03:00
|
|
|
argarg = "NULL"
|
2009-02-20 20:56:36 +03:00
|
|
|
argsize = 0;
|
2008-03-12 01:50:10 +03:00
|
|
|
if (argc) {
|
2009-03-18 20:27:04 +03:00
|
|
|
argarg = "&callarg"
|
|
|
|
argsize = "sizeof(callarg)"
|
|
|
|
printf("\tstruct %s%s_args callarg;\n\n",compatwrap_,funcname) \
|
2008-03-12 01:50:10 +03:00
|
|
|
> rumpcalls
|
|
|
|
for (i = 1; i <= argc; i++) {
|
2009-05-15 19:51:27 +04:00
|
|
|
if (argname[i] == "PAD") {
|
|
|
|
printf("\tSPARG(&callarg, %s) = 0;\n", \
|
|
|
|
argname[i]) > rumpcalls
|
|
|
|
} else {
|
|
|
|
printf("\tSPARG(&callarg, %s) = %s;\n", \
|
|
|
|
argname[i], argname[i]) > rumpcalls
|
|
|
|
}
|
2008-03-12 01:50:10 +03:00
|
|
|
}
|
|
|
|
printf("\n") > rumpcalls
|
|
|
|
} else {
|
|
|
|
printf("\n") > rumpcalls
|
|
|
|
}
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("\terror = rsys_syscall(%s%s, " \
|
|
|
|
"%s, %s, rval);\n", constprefix, funcalias, \
|
2009-02-20 20:56:36 +03:00
|
|
|
argarg, argsize) > rumpcalls
|
2009-11-26 19:34:24 +03:00
|
|
|
printf("\tif (error) {\n\t\trval[0] = -1;\n") > rumpcalls
|
2009-01-23 22:27:18 +03:00
|
|
|
if (returntype != "void") {
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("\t\trsys_seterrno(error);\n\t}\n") > rumpcalls
|
2009-11-26 19:34:24 +03:00
|
|
|
printf("\treturn rval[0];\n") > rumpcalls
|
2009-01-23 22:27:18 +03:00
|
|
|
} else {
|
|
|
|
printf("\t}\n") > rumpcalls
|
|
|
|
}
|
2008-10-13 20:25:12 +04:00
|
|
|
printf("}\n") > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("rsys_alias(%s,rump_enosys)\n", funcname) > rumpcalls
|
2009-02-20 20:56:36 +03:00
|
|
|
|
1994-10-20 07:22:35 +03:00
|
|
|
}
|
2007-11-10 16:22:11 +03:00
|
|
|
$2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" {
|
1994-10-20 07:22:35 +03:00
|
|
|
parseline()
|
1995-10-07 09:25:19 +03:00
|
|
|
putent($2, "")
|
1994-10-20 07:22:35 +03:00
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
2008-02-24 15:51:42 +03:00
|
|
|
$2 == "OBSOL" || $2 == "UNIMPL" || $2 == "EXCL" || $2 == "IGNORED" {
|
1994-10-20 07:22:35 +03:00
|
|
|
if ($2 == "OBSOL")
|
|
|
|
comment="obsolete"
|
1999-06-09 08:25:30 +04:00
|
|
|
else if ($2 == "EXCL")
|
|
|
|
comment="excluded"
|
2008-02-24 15:51:42 +03:00
|
|
|
else if ($2 == "IGNORED")
|
|
|
|
comment="ignored"
|
1994-10-20 07:22:35 +03:00
|
|
|
else
|
|
|
|
comment="unimplemented"
|
|
|
|
for (i = 3; i <= NF; i++)
|
|
|
|
comment=comment " " $i
|
|
|
|
|
2008-02-24 15:51:42 +03:00
|
|
|
if ($2 == "IGNORED")
|
|
|
|
sys_stub = "(sy_call_t *)nullop";
|
|
|
|
else
|
2008-03-10 17:06:46 +03:00
|
|
|
sys_stub = sys_nosys;
|
2008-02-24 15:51:42 +03:00
|
|
|
|
2001-03-30 20:56:36 +04:00
|
|
|
printf("\t{ 0, 0, 0,\n\t %s },\t\t\t/* %d = %s */\n", \
|
2008-02-24 15:51:42 +03:00
|
|
|
sys_stub, syscall, comment) > sysent
|
2010-12-30 19:49:24 +03:00
|
|
|
printf("\t{ 0, 0, SYCALL_NOSYS,\n\t %s },\t\t/* %d = %s */\n", \
|
2009-02-20 20:56:36 +03:00
|
|
|
"(sy_call_t *)rump_enosys", syscall, comment) > rumpsysent
|
2007-11-09 17:54:13 +03:00
|
|
|
printf("\t/* %3d */\t\"#%d (%s)\",\n", syscall, syscall, comment) \
|
|
|
|
> sysnamesbottom
|
1994-10-20 07:22:35 +03:00
|
|
|
if ($2 != "UNIMPL")
|
|
|
|
printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr
|
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
|
|
|
{
|
|
|
|
for (i = 1; i <= ncompat; i++) {
|
|
|
|
if ($2 == compat_upper[i]) {
|
|
|
|
parseline();
|
1998-09-13 08:57:24 +04:00
|
|
|
putent("COMPAT", compat[i])
|
1994-10-20 07:22:35 +03:00
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
1993-04-06 14:37:09 +04:00
|
|
|
}
|
2000-12-09 08:27:08 +03:00
|
|
|
printf("%s: line %d: unrecognized keyword %s\n", infile, NR, $2)
|
1994-10-20 07:22:35 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
END {
|
2009-11-26 20:23:48 +03:00
|
|
|
# output pipe() syscall with its special rval[2] handling
|
2009-11-26 20:19:54 +03:00
|
|
|
if (rumphaspipe) {
|
|
|
|
printf("int rump_sys_pipe(int *);\n") > rumpcallshdr
|
|
|
|
printf("\nint rump_sys_pipe(int *);\n") > rumpcalls
|
|
|
|
printf("int\nrump_sys_pipe(int *fd)\n{\n") > rumpcalls
|
|
|
|
printf("\tregister_t rval[2] = {0, 0};\n") > rumpcalls
|
|
|
|
printf("\tint error = 0;\n") > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("\n\terror = rsys_syscall(SYS_pipe, ") > rumpcalls
|
|
|
|
printf("NULL, 0, rval);\n") > rumpcalls
|
2009-11-26 20:19:54 +03:00
|
|
|
printf("\tif (error) {\n") > rumpcalls
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("\t\trsys_seterrno(error);\n") > rumpcalls
|
2009-11-26 20:19:54 +03:00
|
|
|
printf("\t} else {\n\t\tfd[0] = rval[0];\n") > rumpcalls
|
|
|
|
printf("\t\tfd[1] = rval[1];\n\t}\n") > rumpcalls
|
|
|
|
printf("\treturn error ? -1 : 0;\n}\n") > rumpcalls
|
|
|
|
}
|
|
|
|
|
2000-12-09 08:27:08 +03:00
|
|
|
maxsyscall = syscall
|
|
|
|
if (nsysent) {
|
|
|
|
if (syscall > nsysent) {
|
2001-07-08 23:08:48 +04:00
|
|
|
printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)
|
2000-12-09 08:27:08 +03:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
while (syscall < nsysent) {
|
2001-03-30 20:56:36 +04:00
|
|
|
printf("\t{ 0, 0, 0,\n\t %s },\t\t\t/* %d = filler */\n", \
|
|
|
|
sys_nosys, syscall) > sysent
|
2010-12-30 19:49:24 +03:00
|
|
|
printf("\t{ 0, 0, SYCALL_NOSYS,\n\t %s },\t\t/* %d = filler */\n", \
|
2009-02-20 20:56:36 +03:00
|
|
|
"(sy_call_t *)rump_enosys", syscall) > rumpsysent
|
2010-12-30 14:54:50 +03:00
|
|
|
printf("\t/* %3d */\t\"# filler\",\n", syscall) \
|
|
|
|
> sysnamesbottom
|
2000-12-09 08:27:08 +03:00
|
|
|
syscall++
|
|
|
|
}
|
|
|
|
}
|
2009-02-14 19:21:23 +03:00
|
|
|
printf("};\n") > sysent
|
2009-02-20 20:56:36 +03:00
|
|
|
printf("};\n") > rumpsysent
|
|
|
|
printf("CTASSERT(__arraycount(rump_sysent) == SYS_NSYSENT);\n") > rumpsysent
|
2010-11-04 23:50:29 +03:00
|
|
|
printf("#endif /* RUMP_CLIENT */\n") > rumpsysent
|
1998-02-19 02:14:55 +03:00
|
|
|
printf("};\n") > sysnamesbottom
|
2000-12-09 08:27:08 +03:00
|
|
|
printf("#define\t%sMAXSYSCALL\t%d\n", constprefix, maxsyscall) > sysnumhdr
|
|
|
|
if (nsysent)
|
|
|
|
printf("#define\t%sNSYSENT\t%d\n", constprefix, nsysent) > sysnumhdr
|
1994-10-20 07:22:35 +03:00
|
|
|
} '
|
1993-04-06 14:37:09 +04:00
|
|
|
|
1995-10-07 09:25:19 +03:00
|
|
|
cat $sysprotos >> $sysarghdr
|
2005-12-03 20:04:36 +03:00
|
|
|
echo "#endif /* _${constprefix}SYSCALL_H_ */" >> $sysnumhdr
|
|
|
|
echo "#endif /* _${constprefix}SYSCALLARGS_H_ */" >> $sysarghdr
|
2010-07-19 19:25:47 +04:00
|
|
|
printf "\n#include <rump/rump_syscalls_compat.h>\n" >> $rumpcallshdr
|
2010-05-17 16:35:20 +04:00
|
|
|
printf "\n#endif /* _RUMP_RUMP_SYSCALLS_H_ */\n" >> $rumpcallshdr
|
1995-09-20 01:28:56 +04:00
|
|
|
cat $sysdcl $sysent > $syssw
|
1998-02-19 02:14:55 +03:00
|
|
|
cat $sysnamesbottom >> $sysnames
|
2009-02-20 20:56:36 +03:00
|
|
|
cat $rumpsysent >> $rumpcalls
|
1993-04-06 14:37:09 +04:00
|
|
|
|
1995-04-22 23:42:47 +04:00
|
|
|
#chmod 444 $sysnames $sysnumhdr $syssw
|