summaryrefslogtreecommitdiff
path: root/src/pkg/syscall/mkerrors.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/syscall/mkerrors.sh')
-rwxr-xr-xsrc/pkg/syscall/mkerrors.sh79
1 files changed, 61 insertions, 18 deletions
diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh
index 20b2b9875..cf0afe0bd 100755
--- a/src/pkg/syscall/mkerrors.sh
+++ b/src/pkg/syscall/mkerrors.sh
@@ -11,7 +11,7 @@ unset LANG
export LC_ALL=C
export LC_CTYPE=C
-GCC=gcc
+CC=${CC:-gcc}
uname=$(uname)
@@ -57,6 +57,7 @@ includes_DragonFly='
'
includes_FreeBSD='
+#include <sys/param.h>
#include <sys/types.h>
#include <sys/event.h>
#include <sys/socket.h>
@@ -73,6 +74,14 @@ includes_FreeBSD='
#include <termios.h>
#include <netinet/ip.h>
#include <netinet/ip_mroute.h>
+
+#if __FreeBSD__ >= 10
+#define IFT_CARP 0xf8 // IFT_CARP is deprecated in FreeBSD 10
+#undef SIOCAIFADDR
+#define SIOCAIFADDR _IOW(105, 26, struct oifaliasreq) // ifaliasreq contains if_data
+#undef SIOCSIFPHYADDR
+#define SIOCSIFPHYADDR _IOW(105, 70, struct oifaliasreq) // ifaliasreq contains if_data
+#endif
'
includes_Linux='
@@ -92,9 +101,12 @@ includes_Linux='
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
-#include <linux/if_addr.h>
+#include <linux/if.h>
+#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
+#include <linux/if_packet.h>
+#include <linux/if_addr.h>
#include <linux/filter.h>
#include <linux/netlink.h>
#include <linux/reboot.h>
@@ -103,10 +115,7 @@ includes_Linux='
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/icmpv6.h>
-#include <net/if.h>
-#include <net/if_arp.h>
#include <net/route.h>
-#include <netpacket/packet.h>
#include <termios.h>
#ifndef MSG_FASTOPEN
@@ -118,6 +127,7 @@ includes_NetBSD='
#include <sys/types.h>
#include <sys/param.h>
#include <sys/event.h>
+#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -142,6 +152,7 @@ includes_OpenBSD='
#include <sys/types.h>
#include <sys/param.h>
#include <sys/event.h>
+#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -151,6 +162,7 @@ includes_OpenBSD='
#include <net/bpf.h>
#include <net/if.h>
#include <net/if_types.h>
+#include <net/if_var.h>
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -158,6 +170,36 @@ includes_OpenBSD='
#include <netinet/ip_mroute.h>
#include <netinet/if_ether.h>
#include <net/if_bridge.h>
+
+// We keep some constants not supported in OpenBSD 5.5 and beyond for
+// the promise of compatibility.
+#define EMUL_ENABLED 0x1
+#define EMUL_NATIVE 0x2
+#define IPV6_FAITH 0x1d
+#define IPV6_OPTIONS 0x1
+#define IPV6_RTHDR_STRICT 0x1
+#define IPV6_SOCKOPT_RESERVED1 0x3
+#define SIOCGIFGENERIC 0xc020693a
+#define SIOCSIFGENERIC 0x80206939
+#define WALTSIG 0x4
+'
+
+includes_SunOS='
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <net/bpf.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#include <net/if_types.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <termios.h>
+#include <netinet/ip.h>
+#include <netinet/ip_mroute.h>
'
includes='
@@ -192,7 +234,7 @@ ccflags="$@"
# The gcc command line prints all the #defines
# it encounters while processing the input
- echo "${!indirect} $includes" | $GCC -x c - -E -dM $ccflags |
+ echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
awk '
$1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
@@ -240,6 +282,7 @@ ccflags="$@"
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
$2 ~ /^SIOC/ ||
$2 ~ /^TIOC/ ||
+ $2 !~ "RTF_BITS" &&
$2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
$2 ~ /^BIOC/ ||
$2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
@@ -261,24 +304,24 @@ ccflags="$@"
# Pull out the error names for later.
errors=$(
- echo '#include <errno.h>' | $GCC -x c - -E -dM $ccflags |
+ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
sort
)
# Pull out the signal names for later.
signals=$(
- echo '#include <signal.h>' | $GCC -x c - -E -dM $ccflags |
+ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
sort
)
# Again, writing regexps to a file.
-echo '#include <errno.h>' | $GCC -x c - -E -dM $ccflags |
+echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
sort >_error.grep
-echo '#include <signal.h>' | $GCC -x c - -E -dM $ccflags |
+echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
sort >_signal.grep
@@ -302,8 +345,9 @@ echo ')'
# Run C program to print error and syscall strings.
(
- /bin/echo "
+ echo -E "
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <string.h>
@@ -317,22 +361,21 @@ int errors[] = {
"
for i in $errors
do
- /bin/echo ' '$i,
+ echo -E ' '$i,
done
- /bin/echo "
+ echo -E "
};
int signals[] = {
"
for i in $signals
do
- /bin/echo ' '$i,
+ echo -E ' '$i,
done
- # Use /bin/echo to avoid builtin echo,
- # which interprets \n itself
- /bin/echo '
+ # Use -E because on some systems bash builtin interprets \n itself.
+ echo -E '
};
static int
@@ -387,4 +430,4 @@ main(void)
'
) >_errors.c
-$GCC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
+$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out