summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-19 13:31:04 +0000
committerbde <bde@FreeBSD.org>1995-09-19 13:31:04 +0000
commitad23d1b01eef119d48c0cb43e8624662e0900cdc (patch)
tree609526e4a0d39688a81b25c000f674c78f2e4501 /sys/kern
parent2c8d5766d6d44155fd334a8c6dc1bfdbaec12d70 (diff)
downloadFreeBSD-src-ad23d1b01eef119d48c0cb43e8624662e0900cdc.zip
FreeBSD-src-ad23d1b01eef119d48c0cb43e8624662e0900cdc.tar.gz
Generate prototypes for syscall-implementing functions. Put them in
<sys/sysproto.h> and use them (so far only) in kern/init_sysent.c. Don't put $Id in generated files. kern/syscalls.master: I had to add some new fields to describe some non-orthogonal names. E.g., the args struct for the syscall-implementing function foo() is usually named `foo_args', but for getpid() it is named `args'. sys/sysent.h: sy_call_t is still incomplete to hide a couple of warnings.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/Makefile4
-rw-r--r--sys/kern/makesyscalls.sh80
-rw-r--r--sys/kern/syscalls.master93
3 files changed, 106 insertions, 71 deletions
diff --git a/sys/kern/Makefile b/sys/kern/Makefile
index 21e0f50..f71d5e7 100644
--- a/sys/kern/Makefile
+++ b/sys/kern/Makefile
@@ -7,11 +7,13 @@ ARCH= hp300 i386 luna68k news3400 pmax sparc tahoe vax
all:
@echo "make tags, make links or init_sysent.c only"
-init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall-hide.h: makesyscalls.sh syscalls.master
+init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall-hide.h \
+../sys/sysproto.h: makesyscalls.sh syscalls.master
-mv -f init_sysent.c init_sysent.c.bak
-mv -f syscalls.c syscalls.c.bak
-mv -f ../sys/syscall.h ../sys/syscall.h.bak
-mv -f ../sys/syscall-hide.h ../sys/syscall-hide.h.bak
+ -mv -f ../sys/sysproto.h ../sys/sysproto.h.bak
sh makesyscalls.sh syscalls.master
# Kernel tags:
diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh
index abe49ba..ba27763 100644
--- a/sys/kern/makesyscalls.sh
+++ b/sys/kern/makesyscalls.sh
@@ -1,6 +1,6 @@
#! /bin/sh -
# @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93
-# $Id: makesyscalls.sh,v 1.11 1995/02/14 19:22:29 sos Exp $
+# $Id: makesyscalls.sh,v 1.12 1995/03/16 18:12:39 bde Exp $
set -e
@@ -9,6 +9,8 @@ compat=COMPAT_43
# output files:
sysnames="syscalls.c"
+sysproto="../sys/sysproto.h"
+sysproto_h=_SYS_SYSPROTO_H_
syshdr="../sys/syscall.h"
syssw="init_sysent.c"
syshide="../sys/syscall-hide.h"
@@ -29,6 +31,8 @@ esac
awk < $1 "
BEGIN {
sysdcl = \"$sysdcl\"
+ sysproto = \"$sysproto\"
+ sysproto_h = \"$sysproto_h\"
syscompat = \"$syscompat\"
sysent = \"$sysent\"
sysnames = \"$sysnames\"
@@ -38,11 +42,13 @@ awk < $1 "
infile = \"$1\"
"'
- printf "/*\n * System call switch table.\n *\n" > sysdcl
+ printf "/*\n * System call switch table.\n *\n" > sysent
+ printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysent
+
+ printf "/*\n * System call prototypes.\n *\n" > sysdcl
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl
- printf "\n#ifdef %s\n", compat > syscompat
- printf "#define compat(n, name) n, __CONCAT(o,name)\n\n" > syscompat
+ printf "\n#ifdef %s\n\n", compat > syscompat
printf "/*\n * System call names.\n *\n" > sysnames
printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames
@@ -53,12 +59,26 @@ awk < $1 "
printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshide
}
NR == 1 {
- printf " * created from%s\n */\n\n", $0 > sysdcl
- printf "#include <sys/param.h>\n" > sysdcl
- printf "#include <sys/sysent.h>\n\n" > sysdcl
-
+ gsub("\\$Id: ", "", $0)
+ gsub(" \\$", "", $0)
+ printf " * created from%s\n */\n\n", $0 > sysent
+ printf "#include <sys/param.h>\n" > sysent
+ printf "#include <sys/sysent.h>\n" > sysent
+ printf "#include <sys/sysproto.h>\n\n" > sysent
+ printf "#ifdef %s\n", compat > sysent
+ printf "#define compat(n, name) n, (sy_call_t *)__CONCAT(o,name)\n" > sysent
+ printf("#else\n") > sysent
+ printf("#define compat(n, name) 0, (sy_call_t *)nosys\n") > sysent
+ printf("#endif\n\n") > sysent
+ printf("/* The casts are bogus but will do for now. */\n") > sysent
printf "struct sysent sysent[] = {\n" > sysent
+ printf " * created from%s\n */\n\n", $0 > sysdcl
+ printf("#ifndef %s\n", sysproto_h) > sysdcl
+ printf("#define\t%s\n\n", sysproto_h) > sysdcl
+ printf "#include <sys/types.h>\n\n", $0 > sysdcl
+ printf "struct proc;\n\n", $0 > sysdcl
+
printf " * created from%s\n */\n\n", $0 > sysnames
printf "char *syscallnames[] = {\n" > sysnames
@@ -104,22 +124,33 @@ awk < $1 "
exit 1
}
{ comment = $5
- for (i = 6; i <= NF; i++)
- comment = comment " " $i
- if (NF < 6)
+ if (NF < 8)
+ for (i = 6; i <= NF; i++)
+ comment = comment " " $i
+ if (NF < 6) {
$6 = $5
+ $7 = $5 "_args"
+ if ($2 == "COMPAT")
+ $7 = "o" $7
+ $8 = "int"
+ }
if ($4 != "NOHIDE")
printf("HIDE_%s(%s)\n", $4, $5) > syshide
}
$2 == "STD" || $2 == "NODEF" {
if (( !nosys || $5 != "nosys" ) && ( !lkmnosys ||
- $5 != "lkmnosys"))
- printf("int\t%s();\n", $5) > sysdcl
+ $5 != "lkmnosys")) {
+ printf("struct\t%s;\n", $7) > sysdcl
+ if ($5 == "exit")
+ printf("__dead ") > sysdcl
+ printf("%s\t%s __P((struct proc *, struct %s *, int []));\n", \
+ $8, $5, $7) > sysdcl
+ }
if ($5 == "nosys")
nosys = 1
if ($5 == "lkmnosys")
lkmnosys = 1
- printf("\t{ %d, %s },\t\t\t/* %d = %s */\n", \
+ printf("\t{ %d, (sy_call_t *)%s },\t\t\t/* %d = %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"%s\",\t\t\t/* %d = %s */\n", \
$6, syscall, $6) > sysnames
@@ -130,7 +161,9 @@ awk < $1 "
next
}
$2 == "COMPAT" {
- printf("int\to%s();\n", $5) > syscompat
+ printf("struct\t%s;\n", $7) > syscompat
+ printf("%s\to%s __P((struct proc *, struct %s *, int []));\n", \
+ $8, $5, $7) > syscompat
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
@@ -141,7 +174,7 @@ awk < $1 "
next
}
$2 == "LIBCOMPAT" {
- printf("int\to%s();\n", $5) > syscompat
+ printf("%s\to%s();\n", $8, $5) > syscompat
printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \
$3, $5, syscall, $6) > sysent
printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \
@@ -152,7 +185,7 @@ awk < $1 "
next
}
$2 == "OBSOL" {
- printf("\t{ 0, nosys },\t\t\t/* %d = obsolete %s */\n", \
+ printf("\t{ 0, (sy_call_t *)nosys },\t\t\t/* %d = obsolete %s */\n", \
syscall, comment) > sysent
printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", \
$5, syscall, comment) > sysnames
@@ -162,7 +195,7 @@ awk < $1 "
next
}
$2 == "UNIMPL" {
- printf("\t{ 0, nosys },\t\t\t/* %d = %s */\n", \
+ printf("\t{ 0, (sy_call_t *)nosys },\t\t\t/* %d = %s */\n", \
syscall, comment) > sysent
printf("\t\"#%d\",\t\t\t/* %d = %s */\n", \
syscall, syscall, comment) > sysnames
@@ -174,9 +207,8 @@ awk < $1 "
exit 1
}
END {
- printf("\n#else /* %s */\n", compat) > syscompat
- printf("#define compat(n, name) 0, nosys\n") > syscompat
- printf("#endif /* %s */\n\n", compat) > syscompat
+ printf("\n#endif /* %s */\n", compat) > syscompat
+ printf("\n#endif /* !%s */\n", sysproto_h) > syscompat
printf("};\n\n") > sysent
printf ("struct sysentvec aout_sysvec = {\n") > sysent
@@ -186,7 +218,5 @@ awk < $1 "
printf("};\n") > sysnames
} '
-cat $sysdcl $syscompat $sysent >$syssw
-
-chmod 444 $sysnames $syshdr $syssw $syshide
-
+cat $sysent >$syssw
+cat $sysdcl $syscompat >$sysproto
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 1b14370..ee5a8d6 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,16 +1,19 @@
- $Id: syscalls.master,v 1.14 1995/03/25 16:52:11 davidg Exp $
+ $Id: syscalls.master,v 1.15 1995/04/23 12:20:52 ache Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
;
; System call name/number master file.
; Processed to created init_sysent.c, syscalls.c and syscall.h.
-; Columns: number type nargs namespc name altname/comments
+; Columns: number type nargs namespc name alt{name,tag,rtyp}/comments
; number system call number, must be in order
; type one of STD, OBSOL, UNIMPL, COMPAT
; nargs number of arguments
; namespc one of POSIX, BSD, NOHIDE
; name name of syscall routine
+; If one of the following alts is different, then all appear:
; altname name of system call if different
+; alttag name of args struct tag if different from [o]`name'"_args"
+; altrtyp return type if not int (bogus - syscalls always return int)
; for UNIMPL/OBSOL, name continues with comments
; types:
@@ -28,14 +31,14 @@
; redistributions should be placed in the reserved range at the end
; of the current calls.
-0 STD 0 NOHIDE nosys syscall
-1 STD 1 NOHIDE exit
+0 STD 0 NOHIDE nosys syscall nosys_args int
+1 STD 1 NOHIDE exit exit rexit_args void
2 STD 0 POSIX fork
3 STD 3 POSIX read
4 STD 3 POSIX write
5 STD 3 POSIX open
6 STD 1 POSIX close
-7 STD 4 BSD wait4
+7 STD 4 BSD wait4 wait4 wait_args int
8 COMPAT 2 BSD creat
9 STD 2 POSIX link
10 STD 1 POSIX unlink
@@ -45,15 +48,15 @@
14 STD 3 POSIX mknod
15 STD 2 POSIX chmod
16 STD 3 POSIX chown
-17 STD 1 BSD obreak break
+17 STD 1 BSD obreak break obreak_args int
18 STD 3 BSD getfsstat
19 COMPAT 3 POSIX lseek
-20 STD 0 POSIX getpid
+20 STD 0 POSIX getpid getpid args int
21 STD 4 BSD mount
22 STD 2 BSD unmount
23 STD 1 POSIX setuid
-24 STD 0 POSIX getuid
-25 STD 0 POSIX geteuid
+24 STD 0 POSIX getuid getuid args int
+25 STD 0 POSIX geteuid geteuid args int
26 STD 4 BSD ptrace
27 STD 3 BSD recvmsg
28 STD 3 BSD sendmsg
@@ -67,11 +70,11 @@
36 STD 0 BSD sync
37 STD 2 POSIX kill
38 COMPAT 2 POSIX stat
-39 STD 0 POSIX getppid
+39 STD 0 POSIX getppid getppid args int
40 COMPAT 2 POSIX lstat
41 STD 2 POSIX dup
42 STD 0 POSIX pipe
-43 STD 0 POSIX getegid
+43 STD 0 POSIX getegid getegid args int
44 STD 4 BSD profil
#ifdef KTRACE
45 STD 4 BSD ktrace
@@ -79,7 +82,7 @@
45 UNIMPL 0 BSD ktrace
#endif
46 STD 3 POSIX sigaction
-47 STD 0 POSIX getgid
+47 STD 0 POSIX getgid getgid args int
48 STD 2 POSIX sigprocmask
49 STD 2 BSD getlogin
50 STD 1 BSD setlogin
@@ -92,19 +95,19 @@
57 STD 2 POSIX symlink
58 STD 3 POSIX readlink
59 STD 3 POSIX execve
-60 STD 1 POSIX umask
+60 STD 1 POSIX umask umask umask_args mode_t
61 STD 1 BSD chroot
62 COMPAT 2 POSIX fstat
-63 COMPAT 4 BSD getkerninfo
-64 COMPAT 0 BSD getpagesize
+63 COMPAT 4 BSD getkerninfo getkerninfo getkerninfo_args int
+64 COMPAT 0 BSD getpagesize getpagesize getpagesize_args int
65 STD 3 BSD msync
-66 STD 0 BSD vfork
+66 STD 0 BSD vfork vfork fork_args int
67 OBSOL 0 NOHIDE vread
68 OBSOL 0 NOHIDE vwrite
69 STD 1 BSD sbrk
70 STD 1 BSD sstk
71 COMPAT 6 BSD mmap
-72 STD 1 BSD ovadvise vadvise
+72 STD 1 BSD ovadvise vadvise ovadvise_args int
73 STD 2 BSD munmap
74 STD 3 BSD mprotect
75 STD 3 BSD madvise
@@ -113,14 +116,14 @@
78 STD 3 BSD mincore
79 STD 2 POSIX getgroups
80 STD 2 POSIX setgroups
-81 STD 0 POSIX getpgrp
+81 STD 0 POSIX getpgrp getpgrp args int
82 STD 2 POSIX setpgid
83 STD 3 BSD setitimer
-84 COMPAT 0 BSD wait
+84 COMPAT 0 BSD wait wait wait_args int
85 STD 1 BSD swapon
86 STD 2 BSD getitimer
-87 COMPAT 2 BSD gethostname
-88 COMPAT 2 BSD sethostname
+87 COMPAT 2 BSD gethostname gethostname gethostname_args int
+88 COMPAT 2 BSD sethostname sethostname sethostname_args int
89 STD 0 BSD getdtablesize
90 STD 2 POSIX dup2
91 UNIMPL 2 BSD getdopt
@@ -131,7 +134,7 @@
96 STD 3 BSD setpriority
97 STD 3 BSD socket
98 STD 3 BSD connect
-99 COMPAT 3 BSD accept
+99 COMPAT 3 BSD accept accept accept_args int
100 STD 2 BSD getpriority
101 COMPAT 4 BSD send
102 COMPAT 4 BSD recv
@@ -161,7 +164,7 @@
122 STD 2 BSD settimeofday
123 STD 3 BSD fchown
124 STD 2 BSD fchmod
-125 COMPAT 6 BSD recvfrom
+125 COMPAT 6 BSD recvfrom recvfrom recvfrom_args int
126 STD 2 BSD setreuid
127 STD 2 BSD setregid
128 STD 2 POSIX rename
@@ -177,16 +180,16 @@
138 STD 2 BSD utimes
139 OBSOL 0 NOHIDE 4.2 sigreturn
140 STD 2 BSD adjtime
-141 COMPAT 3 BSD getpeername
-142 COMPAT 0 BSD gethostid
-143 COMPAT 1 BSD sethostid
-144 COMPAT 2 BSD getrlimit
-145 COMPAT 2 BSD setrlimit
+141 COMPAT 3 BSD getpeername getpeername getpeername_args int
+142 COMPAT 0 BSD gethostid gethostid gethostid_args int
+143 COMPAT 1 BSD sethostid sethostid sethostid_args int
+144 COMPAT 2 BSD getrlimit getrlimit getrlimit_args int
+145 COMPAT 2 BSD setrlimit setrlimit setrlimit_args int
146 COMPAT 2 BSD killpg
-147 STD 0 POSIX setsid
+147 STD 0 POSIX setsid setsid args int
148 STD 4 BSD quotactl
-149 COMPAT 4 BSD quota
-150 COMPAT 3 BSD getsockname
+149 COMPAT 4 BSD quota quota quota_args int
+150 COMPAT 3 BSD getsockname getsockname getsockname_args int
; Syscalls 151-180 inclusive are reserved for vendor-specific
; system calls. (This includes various calls added for compatibity
@@ -264,15 +267,15 @@
191 STD 2 POSIX pathconf
192 STD 2 POSIX fpathconf
193 UNIMPL 0 NOHIDE nosys
-194 STD 2 BSD getrlimit
-195 STD 2 BSD setrlimit
+194 STD 2 BSD getrlimit getrlimit __getrlimit_args int
+195 STD 2 BSD setrlimit setrlimit __setrlimit_args int
196 STD 4 BSD getdirentries
197 STD 8 BSD mmap
-198 STD 0 NOHIDE nosys __syscall
+198 STD 0 NOHIDE nosys __syscall __syscall_args int
199 STD 5 POSIX lseek
200 STD 4 BSD truncate
201 STD 4 BSD ftruncate
-202 STD 6 BSD __sysctl
+202 STD 6 BSD __sysctl __sysctl sysctl_args int
; properly, __sysctl should be a NOHIDE, but making an exception
; here allows to avoid one in libc/sys/Makefile.inc.
203 STD 2 BSD mlock
@@ -286,13 +289,13 @@
;
; The following are reserved for loadable syscalls
;
-210 NODEF 0 NOHIDE lkmnosys
-211 NODEF 0 NOHIDE lkmnosys
-212 NODEF 0 NOHIDE lkmnosys
-213 NODEF 0 NOHIDE lkmnosys
-214 NODEF 0 NOHIDE lkmnosys
-215 NODEF 0 NOHIDE lkmnosys
-216 NODEF 0 NOHIDE lkmnosys
-217 NODEF 0 NOHIDE lkmnosys
-218 NODEF 0 NOHIDE lkmnosys
-219 NODEF 0 NOHIDE lkmnosys
+210 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+211 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+212 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+213 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+214 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+215 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+216 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+217 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+218 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
+219 NODEF 0 NOHIDE lkmnosys lkmnosys nosys_args int
OpenPOWER on IntegriCloud