1994-05-24 10:09:53 +00:00
|
|
|
#! /bin/sh -
|
|
|
|
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
|
1999-08-28 01:08:13 +00:00
|
|
|
# $FreeBSD$
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2002-07-12 06:38:34 +00:00
|
|
|
# name of compat options:
|
1994-05-24 10:09:53 +00:00
|
|
|
compat=COMPAT_43
|
2002-07-12 06:38:34 +00:00
|
|
|
compat4=COMPAT_FREEBSD4
|
2007-07-04 22:38:28 +00:00
|
|
|
compat6=COMPAT_FREEBSD6
|
2009-06-24 13:36:37 +00:00
|
|
|
compat7=COMPAT_FREEBSD7
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
# output files:
|
|
|
|
sysnames="syscalls.c"
|
1995-09-19 13:31:04 +00:00
|
|
|
sysproto="../sys/sysproto.h"
|
|
|
|
sysproto_h=_SYS_SYSPROTO_H_
|
1994-05-24 10:09:53 +00:00
|
|
|
syshdr="../sys/syscall.h"
|
1998-03-09 04:00:42 +00:00
|
|
|
sysmk="../sys/syscall.mk"
|
1994-05-24 10:09:53 +00:00
|
|
|
syssw="init_sysent.c"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
syscallprefix="SYS_"
|
|
|
|
switchname="sysent"
|
|
|
|
namesname="syscallnames"
|
2006-08-03 05:29:09 +00:00
|
|
|
systrace="systrace_args.c"
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
# tmp files:
|
2006-08-15 17:09:32 +00:00
|
|
|
sysaue="sysent.aue.$$"
|
1997-12-08 09:00:47 +00:00
|
|
|
sysdcl="sysent.dcl.$$"
|
|
|
|
syscompat="sysent.compat.$$"
|
|
|
|
syscompatdcl="sysent.compatdcl.$$"
|
2002-07-12 06:38:34 +00:00
|
|
|
syscompat4="sysent.compat4.$$"
|
|
|
|
syscompat4dcl="sysent.compat4dcl.$$"
|
2007-07-04 22:38:28 +00:00
|
|
|
syscompat6="sysent.compat6.$$"
|
|
|
|
syscompat6dcl="sysent.compat6dcl.$$"
|
2009-06-24 13:36:37 +00:00
|
|
|
syscompat7="sysent.compat7.$$"
|
|
|
|
syscompat7dcl="sysent.compat7dcl.$$"
|
1997-12-08 09:00:47 +00:00
|
|
|
sysent="sysent.switch.$$"
|
|
|
|
sysinc="sysinc.switch.$$"
|
|
|
|
sysarg="sysarg.switch.$$"
|
2002-07-12 06:38:34 +00:00
|
|
|
sysprotoend="sysprotoend.$$"
|
2008-03-27 01:53:44 +00:00
|
|
|
systracetmp="systrace.$$"
|
1994-05-24 10:09:53 +00:00
|
|
|
|
2009-06-24 13:36:37 +00:00
|
|
|
trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp" 0
|
1994-05-24 10:09:53 +00:00
|
|
|
|
2009-06-24 13:36:37 +00:00
|
|
|
touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp
|
1997-03-29 11:11:18 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
case $# in
|
2002-04-22 13:44:47 +00:00
|
|
|
0) echo "usage: $0 input-file <config-file>" 1>&2
|
1994-05-24 10:09:53 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
1998-06-07 17:13:14 +00:00
|
|
|
if [ -n "$2" -a -f "$2" ]; then
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
. $2
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed -e '
|
|
|
|
s/\$//g
|
|
|
|
:join
|
|
|
|
/\\$/{a\
|
|
|
|
|
|
|
|
N
|
|
|
|
s/\\\n//
|
|
|
|
b join
|
|
|
|
}
|
|
|
|
2,${
|
|
|
|
/^#/!s/\([{}()*,]\)/ \1 /g
|
|
|
|
}
|
|
|
|
' < $1 | awk "
|
1994-05-24 10:09:53 +00:00
|
|
|
BEGIN {
|
2006-08-15 17:09:32 +00:00
|
|
|
sysaue = \"$sysaue\"
|
1994-05-24 10:09:53 +00:00
|
|
|
sysdcl = \"$sysdcl\"
|
1995-09-19 13:31:04 +00:00
|
|
|
sysproto = \"$sysproto\"
|
2002-07-12 06:38:34 +00:00
|
|
|
sysprotoend = \"$sysprotoend\"
|
1995-09-19 13:31:04 +00:00
|
|
|
sysproto_h = \"$sysproto_h\"
|
1994-05-24 10:09:53 +00:00
|
|
|
syscompat = \"$syscompat\"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
syscompatdcl = \"$syscompatdcl\"
|
2002-07-12 06:38:34 +00:00
|
|
|
syscompat4 = \"$syscompat4\"
|
|
|
|
syscompat4dcl = \"$syscompat4dcl\"
|
2007-07-04 22:38:28 +00:00
|
|
|
syscompat6 = \"$syscompat6\"
|
|
|
|
syscompat6dcl = \"$syscompat6dcl\"
|
2009-06-24 13:36:37 +00:00
|
|
|
syscompat7 = \"$syscompat7\"
|
|
|
|
syscompat7dcl = \"$syscompat7dcl\"
|
1994-05-24 10:09:53 +00:00
|
|
|
sysent = \"$sysent\"
|
1998-06-09 03:32:05 +00:00
|
|
|
syssw = \"$syssw\"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
sysinc = \"$sysinc\"
|
|
|
|
sysarg = \"$sysarg\"
|
1994-05-24 10:09:53 +00:00
|
|
|
sysnames = \"$sysnames\"
|
|
|
|
syshdr = \"$syshdr\"
|
1998-03-09 04:00:42 +00:00
|
|
|
sysmk = \"$sysmk\"
|
2006-08-03 05:29:09 +00:00
|
|
|
systrace = \"$systrace\"
|
2008-03-27 01:53:44 +00:00
|
|
|
systracetmp = \"$systracetmp\"
|
1994-05-24 10:09:53 +00:00
|
|
|
compat = \"$compat\"
|
2002-07-12 06:38:34 +00:00
|
|
|
compat4 = \"$compat4\"
|
2007-07-04 22:38:28 +00:00
|
|
|
compat6 = \"$compat6\"
|
2009-06-24 13:36:37 +00:00
|
|
|
compat7 = \"$compat7\"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
syscallprefix = \"$syscallprefix\"
|
|
|
|
switchname = \"$switchname\"
|
|
|
|
namesname = \"$namesname\"
|
1994-05-24 10:09:53 +00:00
|
|
|
infile = \"$1\"
|
|
|
|
"'
|
|
|
|
|
1998-06-09 03:32:05 +00:00
|
|
|
printf "/*\n * System call switch table.\n *\n" > syssw
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syssw
|
2002-01-30 10:22:05 +00:00
|
|
|
printf " * $%s$\n", "FreeBSD" > syssw
|
1995-09-19 13:31:04 +00:00
|
|
|
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
printf "/*\n * System call prototypes.\n *\n" > sysarg
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarg
|
2002-01-30 10:22:05 +00:00
|
|
|
printf " * $%s$\n", "FreeBSD" > sysarg
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1997-12-16 18:51:45 +00:00
|
|
|
printf "\n#ifdef %s\n\n", compat > syscompat
|
2002-07-12 06:38:34 +00:00
|
|
|
printf "\n#ifdef %s\n\n", compat4 > syscompat4
|
2007-07-04 22:38:28 +00:00
|
|
|
printf "\n#ifdef %s\n\n", compat6 > syscompat6
|
2009-06-24 13:36:37 +00:00
|
|
|
printf "\n#ifdef %s\n\n", compat7 > syscompat7
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
printf "/*\n * System call names.\n *\n" > sysnames
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
|
2002-01-30 10:22:05 +00:00
|
|
|
printf " * $%s$\n", "FreeBSD" > sysnames
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
printf "/*\n * System call numbers.\n *\n" > syshdr
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr
|
2002-01-30 10:22:05 +00:00
|
|
|
printf " * $%s$\n", "FreeBSD" > syshdr
|
1998-03-09 04:00:42 +00:00
|
|
|
printf "# FreeBSD system call names.\n" > sysmk
|
|
|
|
printf "# DO NOT EDIT-- this file is automatically generated.\n" > sysmk
|
2002-01-30 15:12:12 +00:00
|
|
|
printf "# $%s$\n", "FreeBSD" > sysmk
|
2006-08-03 05:29:09 +00:00
|
|
|
|
|
|
|
printf "/*\n * System call argument to DTrace register array converstion.\n *\n" > systrace
|
|
|
|
printf " * DO NOT EDIT-- this file is automatically generated.\n" > systrace
|
|
|
|
printf " * $%s$\n", "FreeBSD" > systrace
|
1994-05-24 10:09:53 +00:00
|
|
|
}
|
|
|
|
NR == 1 {
|
1999-08-28 01:15:37 +00:00
|
|
|
gsub("[$]FreeBSD: ", "", $0)
|
1995-09-19 13:50:26 +00:00
|
|
|
gsub(" [$]", "", $0)
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
|
1998-06-09 03:32:05 +00:00
|
|
|
printf " * created from%s\n */\n\n", $0 > syssw
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
|
1998-06-09 03:32:05 +00:00
|
|
|
printf "\n/* The casts are bogus but will do for now. */\n" > sysent
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
printf "struct sysent %s[] = {\n",switchname > sysent
|
1994-05-24 10:09:53 +00:00
|
|
|
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
printf " * created from%s\n */\n\n", $0 > sysarg
|
1998-02-03 17:39:13 +00:00
|
|
|
printf "#ifndef %s\n", sysproto_h > sysarg
|
|
|
|
printf "#define\t%s\n\n", sysproto_h > sysarg
|
2002-09-19 00:43:32 +00:00
|
|
|
printf "#include <sys/signal.h>\n" > sysarg
|
|
|
|
printf "#include <sys/acl.h>\n" > sysarg
|
2008-03-25 09:11:53 +00:00
|
|
|
printf "#include <sys/cpuset.h>\n" > sysarg
|
2006-11-11 16:26:58 +00:00
|
|
|
printf "#include <sys/_semaphore.h>\n" > sysarg
|
2003-04-01 00:35:12 +00:00
|
|
|
printf "#include <sys/ucontext.h>\n\n" > sysarg
|
2006-08-15 17:09:32 +00:00
|
|
|
printf "#include <bsm/audit_kevents.h>\n\n" > sysarg
|
1998-02-03 17:39:13 +00:00
|
|
|
printf "struct proc;\n\n" > sysarg
|
2001-09-12 08:38:13 +00:00
|
|
|
printf "struct thread;\n\n" > sysarg
|
1998-06-08 11:02:00 +00:00
|
|
|
printf "#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n" > sysarg
|
|
|
|
printf "\t\t0 : sizeof(register_t) - sizeof(t))\n\n" > sysarg
|
2001-08-22 23:22:47 +00:00
|
|
|
printf "#if BYTE_ORDER == LITTLE_ENDIAN\n"> sysarg
|
|
|
|
printf "#define\tPADL_(t)\t0\n" > sysarg
|
|
|
|
printf "#define\tPADR_(t)\tPAD_(t)\n" > sysarg
|
|
|
|
printf "#else\n" > sysarg
|
|
|
|
printf "#define\tPADL_(t)\tPAD_(t)\n" > sysarg
|
|
|
|
printf "#define\tPADR_(t)\t0\n" > sysarg
|
|
|
|
printf "#endif\n\n" > sysarg
|
1995-09-19 13:31:04 +00:00
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
printf " * created from%s\n */\n\n", $0 > sysnames
|
2002-10-29 15:47:06 +00:00
|
|
|
printf "const char *%s[] = {\n", namesname > sysnames
|
1994-05-24 10:09:53 +00:00
|
|
|
|
|
|
|
printf " * created from%s\n */\n\n", $0 > syshdr
|
1994-09-13 02:21:48 +00:00
|
|
|
|
1998-03-09 04:00:42 +00:00
|
|
|
printf "# created from%s\nMIASM = ", $0 > sysmk
|
|
|
|
|
2006-08-03 05:29:09 +00:00
|
|
|
printf " * This file is part of the DTrace syscall provider.\n */\n\n" > systrace
|
2010-06-21 09:55:56 +00:00
|
|
|
printf "static void\nsystrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)\n{\n" > systrace
|
2006-08-03 05:29:09 +00:00
|
|
|
printf "\tint64_t *iarg = (int64_t *) uarg;\n" > systrace
|
|
|
|
printf "\tswitch (sysnum) {\n" > systrace
|
|
|
|
|
2008-03-27 01:53:44 +00:00
|
|
|
printf "static void\nsystrace_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)\n{\n\tconst char *p = NULL;\n" > systracetmp
|
|
|
|
printf "\tswitch (sysnum) {\n" > systracetmp
|
|
|
|
|
1994-05-24 10:09:53 +00:00
|
|
|
next
|
|
|
|
}
|
|
|
|
NF == 0 || $1 ~ /^;/ {
|
|
|
|
next
|
|
|
|
}
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
$1 ~ /^#[ ]*include/ {
|
|
|
|
print > sysinc
|
|
|
|
next
|
|
|
|
}
|
1994-05-24 10:09:53 +00:00
|
|
|
$1 ~ /^#[ ]*if/ {
|
|
|
|
print > sysent
|
|
|
|
print > sysdcl
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
print > sysarg
|
1994-05-24 10:09:53 +00:00
|
|
|
print > syscompat
|
2002-07-12 06:38:34 +00:00
|
|
|
print > syscompat4
|
2007-07-04 22:38:28 +00:00
|
|
|
print > syscompat6
|
2009-06-24 13:36:37 +00:00
|
|
|
print > syscompat7
|
1994-05-24 10:09:53 +00:00
|
|
|
print > sysnames
|
|
|
|
savesyscall = syscall
|
|
|
|
next
|
|
|
|
}
|
|
|
|
$1 ~ /^#[ ]*else/ {
|
|
|
|
print > sysent
|
|
|
|
print > sysdcl
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
print > sysarg
|
1994-05-24 10:09:53 +00:00
|
|
|
print > syscompat
|
2002-07-12 06:38:34 +00:00
|
|
|
print > syscompat4
|
2007-07-04 22:38:28 +00:00
|
|
|
print > syscompat6
|
2009-06-24 13:36:37 +00:00
|
|
|
print > syscompat7
|
1994-05-24 10:09:53 +00:00
|
|
|
print > sysnames
|
|
|
|
syscall = savesyscall
|
|
|
|
next
|
|
|
|
}
|
|
|
|
$1 ~ /^#/ {
|
|
|
|
print > sysent
|
|
|
|
print > sysdcl
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
print > sysarg
|
1994-05-24 10:09:53 +00:00
|
|
|
print > syscompat
|
2002-07-12 06:38:34 +00:00
|
|
|
print > syscompat4
|
2007-07-04 22:38:28 +00:00
|
|
|
print > syscompat6
|
2009-06-24 13:36:37 +00:00
|
|
|
print > syscompat7
|
1994-05-24 10:09:53 +00:00
|
|
|
print > sysnames
|
|
|
|
next
|
|
|
|
}
|
|
|
|
syscall != $1 {
|
1998-06-08 11:02:00 +00:00
|
|
|
printf "%s: line %d: syscall number out of sync at %d\n",
|
|
|
|
infile, NR, syscall
|
1994-05-24 10:09:53 +00:00
|
|
|
printf "line is:\n"
|
|
|
|
print
|
|
|
|
exit 1
|
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
# Returns true if the type "name" is the first flag in the type field
|
|
|
|
function type(name, flags, n) {
|
|
|
|
n = split($3, flags, /\|/)
|
|
|
|
return (n > 0 && flags[1] == name)
|
|
|
|
}
|
|
|
|
# Returns true if the flag "name" is set in the type field
|
|
|
|
function flag(name, flags, i, n) {
|
|
|
|
n = split($3, flags, /\|/)
|
|
|
|
for (i = 1; i <= n; i++)
|
|
|
|
if (flags[i] == name)
|
|
|
|
return 1
|
|
|
|
return 0
|
|
|
|
}
|
2000-05-09 21:18:30 +00:00
|
|
|
function align_sysent_comment(column) {
|
|
|
|
printf("\t") > sysent
|
|
|
|
column = column + 8 - column % 8
|
|
|
|
while (column < 56) {
|
|
|
|
printf("\t") > sysent
|
|
|
|
column = column + 8
|
|
|
|
}
|
|
|
|
}
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
function parserr(was, wanted) {
|
1998-06-08 11:02:00 +00:00
|
|
|
printf "%s: line %d: unexpected %s (expected %s)\n",
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
infile, NR, was, wanted
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
function parseline() {
|
2005-05-30 15:09:18 +00:00
|
|
|
f=4 # toss number, type, audit event
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
argc= 0;
|
2000-05-09 21:18:30 +00:00
|
|
|
argssize = "0"
|
2010-06-28 18:06:46 +00:00
|
|
|
thr_flag = "SY_THR_STATIC"
|
|
|
|
if (flag("NOTSTATIC")) {
|
|
|
|
thr_flag = "SY_THR_ABSENT"
|
|
|
|
}
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
if ($NF != "}") {
|
|
|
|
funcalias=$(NF-2)
|
|
|
|
argalias=$(NF-1)
|
|
|
|
rettype=$NF
|
|
|
|
end=NF-3
|
|
|
|
} else {
|
|
|
|
funcalias=""
|
|
|
|
argalias=""
|
|
|
|
rettype="int"
|
|
|
|
end=NF
|
1995-09-19 13:31:04 +00:00
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("NODEF")) {
|
2005-05-30 15:09:18 +00:00
|
|
|
auditev="AUE_NULL"
|
|
|
|
funcname=$4
|
|
|
|
argssize = "AS(" $6 ")"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
if ($f != "{")
|
|
|
|
parserr($f, "{")
|
|
|
|
f++
|
|
|
|
if ($end != "}")
|
|
|
|
parserr($end, "}")
|
|
|
|
end--
|
|
|
|
if ($end != ";")
|
|
|
|
parserr($end, ";")
|
|
|
|
end--
|
|
|
|
if ($end != ")")
|
|
|
|
parserr($end, ")")
|
|
|
|
end--
|
|
|
|
|
|
|
|
f++ #function return type
|
|
|
|
|
|
|
|
funcname=$f
|
|
|
|
if (funcalias == "")
|
|
|
|
funcalias = funcname
|
|
|
|
if (argalias == "") {
|
|
|
|
argalias = funcname "_args"
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("COMPAT"))
|
1995-10-07 23:56:20 +00:00
|
|
|
argalias = "o" argalias
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("COMPAT4"))
|
2002-07-12 06:38:34 +00:00
|
|
|
argalias = "freebsd4_" argalias
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("COMPAT6"))
|
2007-07-04 22:38:28 +00:00
|
|
|
argalias = "freebsd6_" argalias
|
2009-06-24 13:36:37 +00:00
|
|
|
if (flag("COMPAT7"))
|
|
|
|
argalias = "freebsd7_" argalias
|
1995-09-19 13:31:04 +00:00
|
|
|
}
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
f++
|
|
|
|
|
|
|
|
if ($f != "(")
|
|
|
|
parserr($f, ")")
|
|
|
|
f++
|
|
|
|
|
|
|
|
if (f == end) {
|
|
|
|
if ($f != "void")
|
|
|
|
parserr($f, "argument definition")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
while (f <= end) {
|
|
|
|
argc++
|
|
|
|
argtype[argc]=""
|
|
|
|
oldf=""
|
|
|
|
while (f < end && $(f+1) != ",") {
|
|
|
|
if (argtype[argc] != "" && oldf != "*")
|
|
|
|
argtype[argc] = argtype[argc]" ";
|
|
|
|
argtype[argc] = argtype[argc]$f;
|
|
|
|
oldf = $f;
|
|
|
|
f++
|
|
|
|
}
|
|
|
|
if (argtype[argc] == "")
|
|
|
|
parserr($f, "argument definition")
|
|
|
|
argname[argc]=$f;
|
|
|
|
f += 2; # skip name, and any comma
|
|
|
|
}
|
2000-05-09 21:18:30 +00:00
|
|
|
if (argc != 0)
|
|
|
|
argssize = "AS(" argalias ")"
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
}
|
2005-05-30 15:09:18 +00:00
|
|
|
{ comment = $4
|
|
|
|
if (NF < 7)
|
|
|
|
for (i = 5; i <= NF; i++)
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
comment = comment " " $i
|
|
|
|
}
|
2001-08-30 18:50:57 +00:00
|
|
|
|
2005-05-30 15:09:18 +00:00
|
|
|
#
|
|
|
|
# The AUE_ audit event identifier.
|
|
|
|
#
|
|
|
|
{
|
|
|
|
auditev = $2;
|
|
|
|
}
|
|
|
|
|
2009-06-01 16:13:06 +00:00
|
|
|
#
|
|
|
|
# The currently-empty flags field.
|
|
|
|
#
|
|
|
|
{
|
|
|
|
flags = "0";
|
|
|
|
}
|
|
|
|
|
2009-06-17 19:50:38 +00:00
|
|
|
type("STD") || type("NODEF") || type("NOARGS") || type("NOPROTO") \
|
|
|
|
|| type("NOSTD") {
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
parseline()
|
2006-08-03 05:29:09 +00:00
|
|
|
printf("\t/* %s */\n\tcase %d: {\n", funcname, syscall) > systrace
|
2008-03-27 01:53:44 +00:00
|
|
|
printf("\t/* %s */\n\tcase %d:\n", funcname, syscall) > systracetmp
|
2006-08-03 05:29:09 +00:00
|
|
|
if (argc > 0) {
|
2008-03-27 01:53:44 +00:00
|
|
|
printf("\t\tswitch(ndx) {\n") > systracetmp
|
2006-08-03 05:29:09 +00:00
|
|
|
printf("\t\tstruct %s *p = params;\n", argalias) > systrace
|
|
|
|
for (i = 1; i <= argc; i++) {
|
2008-03-27 01:53:44 +00:00
|
|
|
printf("\t\tcase %d:\n\t\t\tp = \"%s\";\n\t\t\tbreak;\n", i - 1, argtype[i]) > systracetmp
|
2006-08-03 05:29:09 +00:00
|
|
|
if (index(argtype[i], "*") > 0 || argtype[i] == "caddr_t")
|
|
|
|
printf("\t\tuarg[%d] = (intptr_t) p->%s; /* %s */\n", \
|
|
|
|
i - 1, \
|
|
|
|
argname[i], argtype[i]) > systrace
|
|
|
|
else if (substr(argtype[i], 1, 1) == "u" || argtype[i] == "size_t")
|
|
|
|
printf("\t\tuarg[%d] = p->%s; /* %s */\n", \
|
|
|
|
i - 1, \
|
|
|
|
argname[i], argtype[i]) > systrace
|
|
|
|
else
|
|
|
|
printf("\t\tiarg[%d] = p->%s; /* %s */\n", \
|
|
|
|
i - 1, \
|
|
|
|
argname[i], argtype[i]) > systrace
|
|
|
|
}
|
2008-03-27 01:53:44 +00:00
|
|
|
printf("\t\tdefault:\n\t\t\tbreak;\n\t\t};\n") > systracetmp
|
2006-08-03 05:29:09 +00:00
|
|
|
}
|
|
|
|
printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace
|
2008-03-27 01:53:44 +00:00
|
|
|
printf("\t\tbreak;\n") > systracetmp
|
2009-06-17 19:50:38 +00:00
|
|
|
if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \
|
|
|
|
!flag("NODEF")) {
|
2008-09-25 20:07:42 +00:00
|
|
|
printf("struct %s {\n", argalias) > sysarg
|
|
|
|
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]) > sysarg
|
|
|
|
printf("};\n") > sysarg
|
1995-10-07 23:56:20 +00:00
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF"))
|
2008-09-25 20:07:42 +00:00
|
|
|
printf("struct %s {\n\tregister_t dummy;\n};\n",
|
|
|
|
argalias) > sysarg
|
2009-06-17 19:50:38 +00:00
|
|
|
if (!flag("NOPROTO") && !flag("NODEF")) {
|
2002-03-19 20:48:32 +00:00
|
|
|
printf("%s\t%s(struct thread *, struct %s *)",
|
1995-10-07 23:56:20 +00:00
|
|
|
rettype, funcname, argalias) > sysdcl
|
1996-09-13 09:20:15 +00:00
|
|
|
printf(";\n") > sysdcl
|
2006-08-15 17:09:32 +00:00
|
|
|
printf("#define\t%sAUE_%s\t%s\n", syscallprefix,
|
|
|
|
funcalias, auditev) > sysaue
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
}
|
2006-07-28 19:05:28 +00:00
|
|
|
printf("\t{ %s, (sy_call_t *)", argssize) > sysent
|
|
|
|
column = 8 + 2 + length(argssize) + 15
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("NOSTD")) {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("%s },", "lkmressys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT") > sysent
|
2009-06-01 16:13:06 +00:00
|
|
|
column = column + length("lkmressys") + length("AUE_NULL") + 3
|
2000-12-01 07:40:20 +00:00
|
|
|
} else {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("%s, %s, NULL, 0, 0, %s, %s },", funcname, auditev, flags, thr_flag) > sysent
|
2009-06-01 16:13:06 +00:00
|
|
|
column = column + length(funcname) + length(auditev) + length(flags) + 3
|
2000-12-01 07:40:20 +00:00
|
|
|
}
|
2000-05-09 21:18:30 +00:00
|
|
|
align_sysent_comment(column)
|
2000-04-03 06:36:14 +00:00
|
|
|
printf("/* %d = %s */\n", syscall, funcalias) > sysent
|
1998-06-08 11:02:00 +00:00
|
|
|
printf("\t\"%s\",\t\t\t/* %d = %s */\n",
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
funcalias, syscall, funcalias) > sysnames
|
2009-06-17 19:50:38 +00:00
|
|
|
if (!flag("NODEF")) {
|
1998-06-08 11:02:00 +00:00
|
|
|
printf("#define\t%s%s\t%d\n", syscallprefix,
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
funcalias, syscall) > syshdr
|
1998-03-09 04:00:42 +00:00
|
|
|
printf(" \\\n\t%s.o", funcalias) > sysmk
|
|
|
|
}
|
1994-05-24 10:09:53 +00:00
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
2009-06-24 13:36:37 +00:00
|
|
|
type("COMPAT") || type("COMPAT4") || type("COMPAT6") || \
|
|
|
|
type("COMPAT7") {
|
2009-06-17 19:50:38 +00:00
|
|
|
if (flag("COMPAT")) {
|
2002-07-12 06:38:34 +00:00
|
|
|
ncompat++
|
|
|
|
out = syscompat
|
|
|
|
outdcl = syscompatdcl
|
|
|
|
wrap = "compat"
|
|
|
|
prefix = "o"
|
2009-06-17 19:50:38 +00:00
|
|
|
descr = "old"
|
|
|
|
} else if (flag("COMPAT4")) {
|
2002-07-12 06:38:34 +00:00
|
|
|
ncompat4++
|
|
|
|
out = syscompat4
|
|
|
|
outdcl = syscompat4dcl
|
|
|
|
wrap = "compat4"
|
|
|
|
prefix = "freebsd4_"
|
2009-06-17 19:50:38 +00:00
|
|
|
descr = "freebsd4"
|
|
|
|
} else if (flag("COMPAT6")) {
|
2007-07-04 22:38:28 +00:00
|
|
|
ncompat6++
|
|
|
|
out = syscompat6
|
|
|
|
outdcl = syscompat6dcl
|
|
|
|
wrap = "compat6"
|
|
|
|
prefix = "freebsd6_"
|
2009-06-17 19:50:38 +00:00
|
|
|
descr = "freebsd6"
|
2009-06-24 13:36:37 +00:00
|
|
|
} else if (flag("COMPAT7")) {
|
|
|
|
ncompat7++
|
|
|
|
out = syscompat7
|
|
|
|
outdcl = syscompat7dcl
|
|
|
|
wrap = "compat7"
|
|
|
|
prefix = "freebsd7_"
|
|
|
|
descr = "freebsd7"
|
2002-07-12 06:38:34 +00:00
|
|
|
}
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
parseline()
|
2009-06-17 19:50:38 +00:00
|
|
|
if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \
|
|
|
|
!flag("NODEF")) {
|
2002-07-12 06:38:34 +00:00
|
|
|
printf("struct %s {\n", argalias) > out
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
for (i = 1; i <= argc; i++)
|
2001-08-22 23:22:47 +00:00
|
|
|
printf("\tchar %s_l_[PADL_(%s)]; %s %s; " \
|
|
|
|
"char %s_r_[PADR_(%s)];\n",
|
|
|
|
argname[i], argtype[i],
|
1998-06-07 17:13:14 +00:00
|
|
|
argtype[i], argname[i],
|
2002-07-12 06:38:34 +00:00
|
|
|
argname[i], argtype[i]) > out
|
|
|
|
printf("};\n") > out
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF"))
|
2001-09-05 01:27:53 +00:00
|
|
|
printf("struct %s {\n\tregister_t dummy;\n};\n",
|
1998-06-08 11:02:00 +00:00
|
|
|
argalias) > sysarg
|
2009-06-17 19:50:38 +00:00
|
|
|
if (!flag("NOPROTO") && !flag("NODEF")) {
|
|
|
|
printf("%s\t%s%s(struct thread *, struct %s *);\n",
|
|
|
|
rettype, prefix, funcname, argalias) > outdcl
|
2009-06-22 20:14:10 +00:00
|
|
|
printf("#define\t%sAUE_%s%s\t%s\n", syscallprefix,
|
|
|
|
prefix, funcname, auditev) > sysaue
|
2009-06-17 19:50:38 +00:00
|
|
|
}
|
|
|
|
if (flag("NOSTD")) {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0, SY_THR_ABSENT },",
|
2009-06-17 19:50:38 +00:00
|
|
|
"0", "lkmressys", "AUE_NULL") > sysent
|
|
|
|
align_sysent_comment(8 + 2 + length("0") + 15 + \
|
|
|
|
length("lkmressys") + length("AUE_NULL") + 3)
|
|
|
|
} else {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("\t{ %s(%s,%s), %s, NULL, 0, 0, %s, %s },",
|
|
|
|
wrap, argssize, funcname, auditev, flags, thr_flag) > sysent
|
2009-06-17 19:50:38 +00:00
|
|
|
align_sysent_comment(8 + 9 + length(argssize) + 1 + \
|
|
|
|
length(funcname) + length(auditev) + \
|
|
|
|
length(flags) + 4)
|
|
|
|
}
|
|
|
|
printf("/* %d = %s %s */\n", syscall, descr, funcalias) > sysent
|
|
|
|
printf("\t\"%s.%s\",\t\t/* %d = %s %s */\n",
|
|
|
|
wrap, funcalias, syscall, descr, funcalias) > sysnames
|
|
|
|
if (flag("COMPAT")) {
|
2007-07-04 22:38:28 +00:00
|
|
|
printf("\t\t\t\t/* %d is old %s */\n",
|
|
|
|
syscall, funcalias) > syshdr
|
2009-06-17 19:50:38 +00:00
|
|
|
} else if (!flag("NODEF")) {
|
2007-07-04 22:38:28 +00:00
|
|
|
printf("#define\t%s%s%s\t%d\n", syscallprefix,
|
|
|
|
prefix, funcalias, syscall) > syshdr
|
|
|
|
printf(" \\\n\t%s%s.o", prefix, funcalias) > sysmk
|
|
|
|
}
|
1994-05-24 10:09:53 +00:00
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
type("OBSOL") {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },") > sysent
|
2000-05-09 21:18:30 +00:00
|
|
|
align_sysent_comment(34)
|
|
|
|
printf("/* %d = obsolete %s */\n", syscall, comment) > sysent
|
1998-06-08 11:02:00 +00:00
|
|
|
printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n",
|
2005-05-30 15:09:18 +00:00
|
|
|
$4, syscall, comment) > sysnames
|
1998-06-08 11:02:00 +00:00
|
|
|
printf("\t\t\t\t/* %d is obsolete %s */\n",
|
1994-05-24 10:09:53 +00:00
|
|
|
syscall, comment) > syshdr
|
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
2009-06-17 19:50:38 +00:00
|
|
|
type("UNIMPL") {
|
2010-06-28 18:06:46 +00:00
|
|
|
printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n",
|
1994-05-24 10:09:53 +00:00
|
|
|
syscall, comment) > sysent
|
1998-06-08 11:02:00 +00:00
|
|
|
printf("\t\"#%d\",\t\t\t/* %d = %s */\n",
|
1994-05-24 10:09:53 +00:00
|
|
|
syscall, syscall, comment) > sysnames
|
|
|
|
syscall++
|
|
|
|
next
|
|
|
|
}
|
|
|
|
{
|
2005-05-30 15:09:18 +00:00
|
|
|
printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $3
|
1994-05-24 10:09:53 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
END {
|
2000-05-09 21:18:30 +00:00
|
|
|
printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc
|
2002-07-12 06:38:34 +00:00
|
|
|
|
2009-06-24 13:36:37 +00:00
|
|
|
if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0 || ncompat7 != 0)
|
1998-06-09 03:32:05 +00:00
|
|
|
printf "#include \"opt_compat.h\"\n\n" > syssw
|
2002-07-12 06:38:34 +00:00
|
|
|
|
|
|
|
if (ncompat != 0) {
|
1998-06-09 03:32:05 +00:00
|
|
|
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
|
|
|
|
printf "#define compat(n, name) 0, (sy_call_t *)nosys\n" > sysinc
|
|
|
|
printf "#endif\n" > sysinc
|
|
|
|
}
|
|
|
|
|
2002-07-12 06:38:34 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2007-07-04 22:38:28 +00:00
|
|
|
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
|
|
|
|
}
|
2002-07-12 06:38:34 +00:00
|
|
|
|
2009-06-24 13:36:37 +00:00
|
|
|
if (ncompat7 != 0) {
|
|
|
|
printf "\n#ifdef %s\n", compat7 > sysinc
|
|
|
|
printf "#define compat7(n, name) n, (sy_call_t *)__CONCAT(freebsd7_,name)\n" > sysinc
|
|
|
|
printf "#else\n" > sysinc
|
|
|
|
printf "#define compat7(n, name) 0, (sy_call_t *)nosys\n" > sysinc
|
|
|
|
printf "#endif\n" > sysinc
|
|
|
|
}
|
|
|
|
|
2007-07-04 22:38:28 +00:00
|
|
|
printf("\n#endif /* %s */\n\n", compat) > syscompatdcl
|
2002-07-12 06:38:34 +00:00
|
|
|
printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl
|
2007-07-04 22:38:28 +00:00
|
|
|
printf("\n#endif /* %s */\n\n", compat6) > syscompat6dcl
|
2009-06-24 13:36:37 +00:00
|
|
|
printf("\n#endif /* %s */\n\n", compat7) > syscompat7dcl
|
2002-07-12 06:38:34 +00:00
|
|
|
|
2006-08-15 17:09:32 +00:00
|
|
|
printf("\n#undef PAD_\n") > sysprotoend
|
2002-07-12 06:38:34 +00:00
|
|
|
printf("#undef PADL_\n") > sysprotoend
|
|
|
|
printf("#undef PADR_\n") > sysprotoend
|
|
|
|
printf("\n#endif /* !%s */\n", sysproto_h) > sysprotoend
|
1994-05-24 10:09:53 +00:00
|
|
|
|
1998-06-28 10:01:52 +00:00
|
|
|
printf("\n") > sysmk
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
printf("};\n") > sysent
|
1994-05-24 10:09:53 +00:00
|
|
|
printf("};\n") > sysnames
|
Add new functionality to makesyscalls.sh:
o optional config-file to set vars: sysnames, sysproto, sysproto_h,
syshdr, syssw, syshide, syscallprefix, switchname, namesname, sysvec.
o change syntax of syscalls.master entry:
remove argument count.
add pseudo-prototype field defining function name and arguments.
o generates correct structure definitions for all system calls
in sys/sysproto.h
o add type NOARGS: same as STD except do not create structure in
sys/sysproto.h
o add type NOPROTO: same as STD except do not create structure or function
prototype in sys/sysproto.h
New functionality provides complete prototype definitions.
Usefull for generating files for emulated systems like my new ibcs2 code.
Update syscalls.master to reflect new changes. For example, read()
entry now looks like:
3 STD POSIX { int ibcs2_read(int fd, char *buf, u_int nbytes); }
This is similar to how NetBSD generates these files.
1995-10-07 06:24:08 +00:00
|
|
|
printf("#define\t%sMAXSYSCALL\t%d\n", syscallprefix, syscall) \
|
1998-06-08 11:02:00 +00:00
|
|
|
> syshdr
|
2006-08-03 05:29:09 +00:00
|
|
|
printf "\tdefault:\n\t\t*n_args = 0;\n\t\tbreak;\n\t};\n}\n" > systrace
|
2008-03-27 01:53:44 +00:00
|
|
|
printf "\tdefault:\n\t\tbreak;\n\t};\n\tif (p != NULL)\n\t\tstrlcpy(desc, p, descsz);\n}\n" > systracetmp
|
1994-05-24 10:09:53 +00:00
|
|
|
} '
|
|
|
|
|
1998-06-09 03:32:05 +00:00
|
|
|
cat $sysinc $sysent >> $syssw
|
2002-07-12 06:38:34 +00:00
|
|
|
cat $sysarg $sysdcl \
|
|
|
|
$syscompat $syscompatdcl \
|
|
|
|
$syscompat4 $syscompat4dcl \
|
2007-07-04 22:38:28 +00:00
|
|
|
$syscompat6 $syscompat6dcl \
|
2009-06-24 13:36:37 +00:00
|
|
|
$syscompat7 $syscompat7dcl \
|
2006-08-15 17:09:32 +00:00
|
|
|
$sysaue $sysprotoend > $sysproto
|
2008-03-27 01:53:44 +00:00
|
|
|
cat $systracetmp >> $systrace
|
2002-07-12 06:38:34 +00:00
|
|
|
|