Bug#323154: header protection in <sys/syscall.h>
Package: kfreebsd-5
Severity: wishlist
Tags: patch
Hi,
This patch adds header protection to kfreebsd's <sys/syscall.h>. Note that this
is a dynamicaly-generated file. My patch fixes _both_ the generator script and
the header so that the fix is also applied when building header packages.
After this is applied, it will be suitable to replace glibc's <sys/syscall.h>
(which is just an old version from kfreebsd) with up-to-date version in
kfreebsd-kernel-headers.
I'm forwarding it to upstream, too.
-- System Information:
Debian Release: testing/unstable
Architecture: kfreebsd-i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: GNU/kFreeBSD 5.3-1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
diff -ur /usr/src/kfreebsd5/src/sys/kern/makesyscalls.sh sys/kern/makesyscalls.sh
--- /usr/src/kfreebsd5/src/sys/kern/makesyscalls.sh 2003-12-23 04:50:43.000000000 +0100
+++ sys/kern/makesyscalls.sh 2005-08-14 15:05:41.000000000 +0200
@@ -13,6 +13,7 @@
sysproto="../sys/sysproto.h"
sysproto_h=_SYS_SYSPROTO_H_
syshdr="../sys/syscall.h"
+syshdr_h=_SYS_SYSCALL_H_
sysmk="../sys/syscall.mk"
syssw="init_sysent.c"
syscallprefix="SYS_"
@@ -72,6 +73,7 @@
sysarg = \"$sysarg\"
sysnames = \"$sysnames\"
syshdr = \"$syshdr\"
+ syshdr_h = \"$syshdr_h\"
sysmk = \"$sysmk\"
compat = \"$compat\"
compat4 = \"$compat4\"
@@ -137,6 +139,8 @@
printf "const char *%s[] = {\n", namesname > sysnames
printf " * created from%s\n */\n\n", $0 > syshdr
+ printf "#ifndef %s\n", syshdr_h > syshdr
+ printf "#define\t%s\n\n", syshdr_h > syshdr
printf "# created from%s\nMIASM = ", $0 > sysmk
@@ -486,6 +490,7 @@
printf("};\n") > sysnames
printf("#define\t%sMAXSYSCALL\t%d\n", syscallprefix, syscall) \
> syshdr
+ printf("\n#endif /* !%s */\n", syshdr_h) > syshdr
} '
cat $sysinc $sysent >> $syssw
diff -ur /usr/src/kfreebsd5/src/sys/sys/syscall.h sys/sys/syscall.h
--- /usr/src/kfreebsd5/src/sys/sys/syscall.h 2004-10-09 17:25:41.000000000 +0200
+++ sys/sys/syscall.h 2005-08-14 15:01:54.000000000 +0200
@@ -6,6 +6,9 @@
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.176.2.1 2004/10/09 15:12:33 mtm Exp
*/
+#ifndef _SYS_SYSCALL_H_
+#define _SYS_SYSCALL_H_
+
#define SYS_syscall 0
#define SYS_exit 1
#define SYS_fork 2
@@ -358,3 +361,5 @@
#define SYS_thr_wake 443
#define SYS_kldunloadf 444
#define SYS_MAXSYSCALL 445
+
+#endif /* !_SYS_SYSCALL_H_ */
Reply to: