aboutsummaryrefslogtreecommitdiff
path: root/Mk/Scripts/rust-compat11-canary.sh
blob: ccc158cba66430efadd1d19658c970a3030ec4b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# MAINTAINER: rust@FreeBSD.org
set -eu
set -o pipefail

if [ "${OPSYS}" != FreeBSD ] || [ "${OSVERSION}" -lt 1200000 ]; then
	exit 0
fi

cat <<EOF | ${CC} -o "${WRKDIR}/compat11_canary" -xc -
#include <sys/syscall.h>
#include <errno.h>
#include <unistd.h>

int
main(void)
{
	return syscall(SYS_freebsd11_mknod, "", 0, 0) < 0 && errno == ENOSYS;
}
EOF
# Canary might be aborted with SIGSYS
ulimit -c 0
if ! "${WRKDIR}/compat11_canary"; then
	echo "=> Sanity check failed: kernel is missing COMPAT_FREEBSD11"
	echo "=> Aborting build"
	exit 1
fi