nightly/conf/freebsd.* files. The default configuration
sends an e-mail to the valgrind-testresults mailing list.
+3. Version specific code
+
+For its own use of syscalls and memory layout Valgrind sometimes needs
+to detect which version of FreeBSD it is being built on. Historically
+that was done using 'uname' at configure time. It can also be achieved
+using the __FreeBSD_version macro (in osreldate.h and sys/param.h).
+The former header just defines that macro. To see what changes are associated
+with different values of the macro you can search the FreeBSD source and
+git history. You can also look at
+
+https://docs.freebsd.org/en/books/porters-handbook/versions/
+
+
Feedback
~~~~~~~~
*freebsd*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="freebsd"
- AC_DEFINE([FREEBSD_11], 1100, [FREEBSD_VERS value for FreeBSD 11.x])
- freebsd_11=1100
- AC_DEFINE([FREEBSD_12], 1200, [FREEBSD_VERS value for FreeBSD 12.0 to 12.1])
- freebsd_12=1200
- AC_DEFINE([FREEBSD_12_2], 1220, [FREEBSD_VERS value for FreeBSD 12.2])
- freebsd_12_2=1220
- AC_DEFINE([FREEBSD_13_0], 1300, [FREEBSD_VERS value for FreeBSD 13.0])
- freebsd_13_0=1300
- AC_DEFINE([FREEBSD_13_1], 1310, [FREEBSD_VERS value for FreeBSD 13.1])
- freebsd_13_1=1310
- AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2])
- freebsd_13_2=1320
- AC_DEFINE([FREEBSD_13_3], 1330, [FREEBSD_VERS value for FreeBSD 13.3])
- freebsd_13_3=1330
- AC_DEFINE([FREEBSD_13_4], 1340, [FREEBSD_VERS value for FreeBSD 13.4])
- freebsd_13_4=1340
- AC_DEFINE([FREEBSD_14_0], 1400, [FREEBSD_VERS value for FreeBSD 14.0])
- freebsd_14_0=1400
- AC_DEFINE([FREEBSD_14_1], 1410, [FREEBSD_VERS value for FreeBSD 14.1])
- freebsd_14_1=1410
- AC_DEFINE([FREEBSD_15], 1500, [FREEBSD_VERS value for FreeBSD 15.x])
- freebsd_15=1500
-
- AC_MSG_CHECKING([for the kernel version])
- kernel=`uname -r`
-
- case "${kernel}" in
- 11.*)
- AC_MSG_RESULT([FreeBSD 11.x (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_11, [FreeBSD version])
- freebsd_vers=$freebsd_11
- ;;
- 12.*)
- case "${kernel}" in
- 12.[[0-1]]-*)
- AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_12, [FreeBSD version])
- freebsd_vers=$freebsd_12
- ;;
- *)
- AC_MSG_RESULT([FreeBSD 12.x (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_12_2, [FreeBSD version])
- freebsd_vers=$freebsd_12_2
- ;;
- esac
- ;;
- 13.*)
- case "${kernel}" in
- 13.0-*)
- AC_MSG_RESULT([FreeBSD 13.0 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13_0, [FreeBSD version])
- freebsd_vers=$freebsd_13_0
- ;;
- 13.1-*)
- AC_MSG_RESULT([FreeBSD 13.1 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13_1, [FreeBSD version])
- freebsd_vers=$freebsd_13_1
- ;;
- 13.2-*)
- AC_MSG_RESULT([FreeBSD 13.2 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version])
- freebsd_vers=$freebsd_13_2
- ;;
- 13.3-*)
- AC_MSG_RESULT([FreeBSD 13.3 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13_3, [FreeBSD version])
- freebsd_vers=$freebsd_13_3
- ;;
- 13.4-*)
- AC_MSG_RESULT([FreeBSD 13.4 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_13_4, [FreeBSD version])
- freebsd_vers=$freebsd_13_4
- ;;
- *)
- AC_MSG_RESULT([unsupported (${kernel})])
- AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
- ;;
- esac
- ;;
- 14.*)
- case "${kernel}" in
- 14.0-*)
- AC_MSG_RESULT([FreeBSD 14.0 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_14_0, [FreeBSD version])
- freebsd_vers=$freebsd_14_0
- ;;
- 14.1-*)
- AC_MSG_RESULT([FreeBSD 14.1 (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_14_1, [FreeBSD version])
- freebsd_vers=$freebsd_14_1
- ;;
- *)
- AC_MSG_RESULT([unsupported (${kernel})])
- AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
- ;;
- esac
- ;;
- 15.*)
- AC_MSG_RESULT([FreeBSD 15.x (${kernel})])
- AC_DEFINE([FREEBSD_VERS], FREEBSD_15, [FreeBSD version])
- freebsd_vers=$freebsd_15
- ;;
- *)
- AC_MSG_RESULT([unsupported (${kernel})])
- AC_MSG_ERROR([Valgrind works on FreeBSD 11.x to 15.x])
- ;;
- esac
DEFAULT_SUPP="$srcdir/freebsd.supp $srcdir/freebsd-helgrind.supp $srcdir/freebsd-drd.supp ${DEFAULT_SUPP}"
;;
if test "$VGCONF_OS" = "freebsd" ; then
-AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, test $freebsd_vers -ge $freebsd_13_0)
-AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, test $freebsd_vers -ge $freebsd_15)
+AC_CHECK_FUNCS([ \
+ eventfd
+ ])
+
+AM_CONDITIONAL([FREEBSD_EVENTFD],
+ [test x$ac_cv_func_eventfd = xyes])
+
+AC_MSG_CHECKING([for the SYS___realpathat syscall (FreeBSD-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/syscall.h>
+]], [[
+ return !SYS___realpathat;
+]])], [
+freebsd_realpathat_syscall=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([FREEBSD_REALPATHAT_SYSCALL], 1,
+ [Define to 1 if you have the new SYS___realpathat syscall.])
+], [
+freebsd_realpathat_syscall=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, test x$freebsd_realpathat_syscall = xyes)
+
+AC_MSG_CHECKING([for syscalls only in FreeBSD 13 and later])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/syscall.h>
+]], [[
+ return !SYS_aio_readv;
+]])], [
+freebsd_syscall13=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([FREEBSD_SYSCALL13], 1,
+ [Define to 1 if you are using FreeBSD 13 or later.])
+], [
+freebsd_syscall13=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(FREEBSD_SYSCALL13, test x$freebsd_syscall13 = xyes)
+
+AC_MSG_CHECKING([for the SYS_kqueuex syscall (FreeBSD-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/syscall.h>
+]], [[
+ return !SYS_kqueuex;
+]])], [
+freebsd_kqueuex_syscall=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([FREEBSD_KQUEUEX_SYSCALL], 1,
+ [Define to 1 if you have the new SYS___realpathat syscall.])
+], [
+freebsd_kqueuex_syscall=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, test x$freebsd_kqueuex_syscall = xyes)
+
+AC_MSG_CHECKING([for the SYS_timerfd_create syscall (FreeBSD-specific)])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/syscall.h>
+]], [[
+ return !SYS_timerfd_create;
+]])], [
+freebsd_timerfd_syscall=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([FREEBSD_TIMERFD_SYSCALL], 1,
+ [Define to 1 if you have the new SYS_timer_fd_create syscall.])
+], [
+freebsd_timerfd_syscall=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, test x$freebsd_timerfd_syscall = xyes)
+
+AC_MSG_CHECKING([for syscalls only in FreeBSD 15 and later])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/syscall.h>
+]], [[
+ return !SYS_getrlimitusage;
+]])], [
+freebsd_syscall15=yes
+AC_MSG_RESULT([yes])
+AC_DEFINE([FREEBSD_SYSCALL15], 1,
+ [Define to 1 if you are using FreeBSD 15 or later.])
+], [
+freebsd_syscall15=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL(FREEBSD_SYSCALL15, test x$freebsd_syscall15 = xyes)
else
-AM_CONDITIONAL(FREEBSD_VERS_13_PLUS, false)
-AM_CONDITIONAL(FREEBSD_VERS_15_PLUS, false)
+AM_CONDITIONAL(FREEBSD_EVENTFD, false)
+AM_CONDITIONAL(FREEBSD_REALPATHAT_SYSCALL, false)
+AM_CONDITIONAL(FREEBSD_SYSCALL13, false)
+AM_CONDITIONAL(FREEBSD_KQUEUEX_SYSCALL, false)
+AM_CONDITIONAL(FREEBSD_TIMERFD_SYSCALL, false)
+AM_CONDITIONAL(FREEBSD_SYSCALL15, false)
fi # test "$VGCONF_OS" = "freebsd"
close_range \
wcsncpy \
free_aligned_sized \
- sbrk \
+ sbrk \
wcpncpy \
wcsxfrm \
sem_timedwait \
- sem_clockwait_np
+ sem_clockwait_np \
+ fdatasync \
+ getrandom
])
# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
[test x$ac_cv_func_sem_timedwait = xyes])
AM_CONDITIONAL([HAVE_SEM_CLOCKWAIT_NP],
[test x$ac_cv_func_sem_clockwait_np = xyes])
+AM_CONDITIONAL([HAVE_FDATASYNC],
+ [test x$ac_cv_func_fdatasync = xyes])
+AM_CONDITIONAL([HAVE_GETRANDOM],
+ [test x$ac_cv_func_getrandom = xyes])
if test x$VGCONF_PLATFORM_PRI_CAPS = xMIPS32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xMIPS64_LINUX \
}
return False;
# elif defined(VGO_freebsd)
-#if (FREEBSD_VERS < FREEBSD_12)
+#if (__FreeBSD_version < 1200031)
struct vki_freebsd11_stat buf;
SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
#else
stringsize += sizeof(struct vki_vdso_timehands);
break;
#endif
-#if (FREEBSD_VERS >= FREEBSD_13_0)
+ // from FreeBSD 13
case VKI_AT_PS_STRINGS:
stringsize += sizeof(struct vki_ps_strings);
break;
-#endif
-#if (FREEBSD_VERS >= FREEBSD_13_1)
+ // from FreeBSD 13.1
// case AT_FXRNG:
// case AT_KPRELOAD:
-#endif
default:
break;
}
case VKI_AT_OSRELDATE:
case VKI_AT_PAGESIZESLEN:
case VKI_AT_CANARYLEN:
-
-#if (FREEBSD_VERS >= FREEBSD_11)
case VKI_AT_EHDRFLAGS:
-#endif
/* All these are pointerless, so we don't need to do
anything about them. */
break;
break;
#endif
-#if (FREEBSD_VERS >= FREEBSD_13_0)
+ // From FreeBSD 13.0
/* @todo PJF BSDFLAGS causes serveral testcases to crash.
Not sure why, it seems to be used for sigfastblock */
// case AT_BSDFLAGS:
case VKI_AT_ENVV:
auxv->u.a_val = (Word)VG_(client_envp);
break;
-#endif
-#if (FREEBSD_VERS >= FREEBSD_13_1)
+ // from FreeBSD 13.1
// I think that this is a pointer to a "fenestrasX" structture
// lots of stuff that I don't understand
// arc4random, passing through VDSO page ...
// case AT_FXRNG:
// Again a pointer, to the VDSO base for use by rtld
// case AT_KPRELOAD:
-#endif
-#if (FREEBSD_VERS >= FREEBSD_13_2)
+ // from FreeBSD 13.2
case VKI_AT_USRSTACKBASE:
VG_(debugLog)(2, "initimg",
"usrstackbase from OS %lx\n",
clstack_max_size);
break;
-#endif
case VKI_AT_PHDR:
if (info->phdr == 0) {
SysRes res = VG_(do_syscall3)(__NR_mknod,
(UWord)pathname, mode, dev);
# elif defined(VGO_freebsd)
-#if (FREEBSD_VERS < FREEBSD_12)
+#if (__FreeBSD_version < 1200031)
SysRes res = VG_(do_syscall3)(__NR_freebsd11_mknod,
(UWord)pathname, mode, dev);
#else
}
# elif defined(VGO_freebsd)
{
-#if (FREEBSD_VERS < FREEBSD_12)
+#if (__FreeBSD_version < 1200031)
struct vki_freebsd11_stat buf;
res = VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)&buf);
#else
}
# elif defined(VGO_freebsd)
{
-#if (FREEBSD_VERS < FREEBSD_12)
+#if (__FreeBSD_version < 1200031)
struct vki_freebsd11_stat buf;
res = VG_(do_syscall2)(__NR_fstat, (RegWord)fd, (RegWord)(Addr)&buf);
#else
SysRes res;
VG_(memset)(vgbuf, 0, sizeof(*vgbuf));
-#if (FREEBSD_VERS < FREEBSD_12)
+#if (__FreeBSD_version < 1200031)
struct vki_freebsd11_stat buf;
res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
#else
{
vg_assert(path);
vg_assert(resolved);
-#if (FREEBSD_VERS >= FREEBSD_13_0)
+#if (__FreeBSD_version >= 1300080)
return !sr_isError(VG_(do_syscall5)(__NR___realpathat, VKI_AT_FDCWD, (RegWord)path, (RegWord)resolved, VKI_PATH_MAX, 0));
#else
// poor man's realpath
Int VG_(sysctlbyname)(const HChar *name, void *oldp, SizeT *oldlenp, const void *newp, SizeT newlen)
{
vg_assert(name);
-#if (FREEBSD_VERS >= FREEBSD_12_2)
+#if ((__FreeBSD_version >= 1201522 && __FreeBSD_version <= 1300000) || __FreeBSD_version >= 1300045)
SysRes res = VG_(do_syscall6)(__NR___sysctlbyname, (RegWord)name, VG_(strlen)(name), (RegWord)oldp, (RegWord)oldlenp, (RegWord)newp, (RegWord)newlen);
return sr_isError(res) ? -1 : sr_Res(res);
#else
i = 1;
if (do_stats) stats.nr++;
- // Does this apply to macOS 10.14 and earlier?
-# if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13_0)
- if (VG_(is_valid_tid)(tid_if_known) &&
- VG_(is_in_syscall)(tid_if_known) &&
- i < max_n_ips) {
- /* On FreeBSD, all the system call stubs have no function
- * prolog. So instead of top of the stack being a new
- * frame comprising a saved BP and a return address, we
- * just have the return address in the caller's frame.
- * Adjust for this by recording the return address.
- */
- if (debug)
- VG_(printf)(" in syscall, use XSP-1\n");
- ips[i] = *(Addr *)uregs.xsp - 1;
- if (sps) sps[i] = uregs.xsp;
- if (fps) fps[i] = uregs.xbp;
- i++;
- }
-# endif
-
while (True) {
if (i >= max_n_ips)
#if defined(VGP_amd64_linux) || defined(VGP_amd64_darwin) \
|| defined(VGP_amd64_solaris) || defined(VGP_amd64_freebsd)
+/*
+ * Concerning the comment in the function about syscalls, this also used to
+ * apply to FreeBSD. I'm not sure what changed or when. The situation with
+ * FreeBSD going at least as far back as version 12.1 (so Nov 2019) is that
+ * system calls are implemented with generated wrappers that call through
+ * an interposing table of function pointers. The restult when built with
+ * clang is that code for the frame pointer prolog is generated but then
+ * an optimized sibling call is made. That means ehe frame pointer is popped
+ * off the stack and a jmp is made to the function in the table rather than
+ * a call.
+ *
+ * The end result is that, when we are in a syscall it is as though there were
+ * no prolog but a copy of the frame pointer is stored 64byte word below the
+ * stack pointer. If FreeBSD uses the hack for Darwin that sets
+ * ips[i] = *(Addr *)uregs.xsp - 1;
+ * then the caller of the syyscall gets added twice.
+ */
+
UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
/*OUT*/Addr* ips, UInt max_n_ips,
/*OUT*/Addr* sps, /*OUT*/Addr* fps,
VG_(printf)(" ipsS[%d]=%#08lx rbp %#08lx rsp %#08lx\n",
i-1, ips[i-1], uregs.xbp, uregs.xsp);
-# if defined(VGO_darwin) || (defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_13_0))
+# if defined(VGO_darwin)
if (VG_(is_valid_tid)(tid_if_known) &&
VG_(is_in_syscall)(tid_if_known) &&
i < max_n_ips) {
- /* On Darwin and FreeBSD, all the system call stubs have no function
+ /* On Darwin, all the system call stubs have no function
* prolog. So instead of top of the stack being a new
* frame comprising a saved BP and a return address, we
* just have the return address in the caller's frame.
// generic setgid 181
DECL_TEMPLATE(freebsd, sys_setegid) // 182
DECL_TEMPLATE(freebsd, sys_seteuid) // 183
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_stat) // 188
DECL_TEMPLATE(freebsd, sys_freebsd11_fstat) // 189
DECL_TEMPLATE(freebsd, sys_freebsd11_lstat)// 190
-#else
-DECL_TEMPLATE(freebsd, sys_stat) // 188
-DECL_TEMPLATE(freebsd, sys_fstat) // 189
-DECL_TEMPLATE(freebsd, sys_lstat) // 190
-#endif
+
DECL_TEMPLATE(freebsd, sys_pathconf) // 191
DECL_TEMPLATE(freebsd, sys_fpathconf) // 192
// generic getrlimit 194
// generic setrlimit 195
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_getdirentries) // 196
-#else
-DECL_TEMPLATE(freebsd, sys_getdirentries) // 196
-#endif
//DECL_TEMPLATE(freebsd, sys_freebsd6_mmap) // 197
//DECL_TEMPLATE(freebsd, sys_freebsd6_lseek) // 199
DECL_TEMPLATE(freebsd, sys_fhopen) // 298
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_fhstat) // 299
-#else
-DECL_TEMPLATE(freebsd, sys_fhstat) // 299
-#endif
DECL_TEMPLATE(freebsd, sys_modnext) // 300
DECL_TEMPLATE(freebsd, sys_modstat) // 301
DECL_TEMPLATE(freebsd, sys_getresgid) // 361
DECL_TEMPLATE(freebsd, sys_kqueue) // 362
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200033
DECL_TEMPLATE(freebsd, sys_freebsd11_kevent) // 363
-#else
-DECL_TEMPLATE(freebsd, sys_kevent) // 363
-#endif
+
DECL_TEMPLATE(freebsd, sys_extattr_set_fd) // 371
DECL_TEMPLATE(freebsd, sys_extattr_get_fd) // 372
DECL_TEMPLATE(freebsd, sys_extattr_delete_fd) // 373
DECL_TEMPLATE(freebsd, sys_uuidgen) // 392
DECL_TEMPLATE(freebsd, sys_sendfile) // 292
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_getfsstat) // 395
DECL_TEMPLATE(freebsd, sys_freebsd11_statfs) // 396
DECL_TEMPLATE(freebsd, sys_freebsd11_fstatfs) // 397
DECL_TEMPLATE(freebsd, sys_freebsd11_fhstatfs) // 398
-#else
-DECL_TEMPLATE(freebsd, sys_getfsstat) // 395
-DECL_TEMPLATE(freebsd, sys_statfs) // 396
-DECL_TEMPLATE(freebsd, sys_fstatfs) // 397
-DECL_TEMPLATE(freebsd, sys_fhstatfs) // 398
-#endif
// unimpl ksem_close 400
// unimpl ksem_post 401
DECL_TEMPLATE(freebsd, sys_getcontext) // 421
DECL_TEMPLATE(freebsd, sys_setcontext) // 422
DECL_TEMPLATE(freebsd, sys_swapcontext) // 423
-
-#if (FREEBSD_VERS >= FREEBSD_13_1)
DECL_TEMPLATE(freebsd, sys_freebsd13_swapoff) // 424
-#else
-DECL_TEMPLATE(freebsd, sys_swapoff) // 424
-#endif
-
DECL_TEMPLATE(freebsd, sys___acl_get_link) // 425
DECL_TEMPLATE(freebsd, sys___acl_set_link) // 426
DECL_TEMPLATE(freebsd, sys___acl_delete_link) // 427
DECL_TEMPLATE(freebsd, sys_fchmodat) //490
DECL_TEMPLATE(freebsd, sys_fchownat) // 491
DECL_TEMPLATE(freebsd, sys_fexecve) // 492
-#if (FREEBSD_VERS >= FREEBSD_12)
+// added with __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_fstatat) // 493
-#else
-DECL_TEMPLATE(freebsd, sys_fstatat) // 493
-#endif
+
DECL_TEMPLATE(freebsd, sys_futimesat) // 494
DECL_TEMPLATE(freebsd, sys_linkat) // 495
DECL_TEMPLATE(freebsd, sys_mkdirat) // 496
DECL_TEMPLATE(freebsd, sys_mkfifoat) // 497
-#if (FREEBSD_VERS >= FREEBSD_12)
+// added with __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_freebsd11_mknodat) // 498
-#else
-DECL_TEMPLATE(freebsd, sys_mknodat) // 498
-#endif
DECL_TEMPLATE(freebsd, sys_openat) // 499
DECL_TEMPLATE(freebsd, sys_readlinkat) // 500
DECL_TEMPLATE(freebsd, sys_utimensat) // 547
DECL_TEMPLATE(freebsd, sys_fdatasync) // 550
-#if (FREEBSD_VERS >= FREEBSD_12)
-
+// added with __FreeBSD_version 12000
DECL_TEMPLATE(freebsd, sys_fstat) // 551
DECL_TEMPLATE(freebsd, sys_fstatat) // 552
DECL_TEMPLATE(freebsd, sys_fhstat) // 553
DECL_TEMPLATE(freebsd, sys_getfsstat) // 557
DECL_TEMPLATE(freebsd, sys_fhstatfs) // 558
DECL_TEMPLATE(freebsd, sys_mknodat) // 559
+
+// added with __FreeBSD_version 1200033)
DECL_TEMPLATE(freebsd, sys_kevent) // 560
+
DECL_TEMPLATE(freebsd, sys_cpuset_getdomain) // 561
DECL_TEMPLATE(freebsd, sys_cpuset_setdomain) // 562
DECL_TEMPLATE(freebsd, sys_getrandom) // 563
+
+// added with __FreeBSD_version 1200031
DECL_TEMPLATE(freebsd, sys_getfhat) // 654
DECL_TEMPLATE(freebsd, sys_fhlink) // 565
DECL_TEMPLATE(freebsd, sys_fhlinkat) // 566
DECL_TEMPLATE(freebsd, sys_fhreadlink) // 567
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_12_2)
-
+// added with __FreeBSD_version 1300018
DECL_TEMPLATE(freebsd, sys_funlinkat) // 568
DECL_TEMPLATE(freebsd, sys_copy_file_range) // 569
+// __FreeBSD_version 1201522 and 1300045
DECL_TEMPLATE(freebsd, sys___sysctlbyname) // 570
-#if (FREEBSD_VERS >= FREEBSD_13_0)
// looks like close_range got backported
// to 12.2 leaving these 4 marked as UNIMPL in 12.2
+// added with __FreeBSD_version 1300048
DECL_TEMPLATE(freebsd, sys_shm_open2) // 571
// unimpl __NR_shm_rename 572
DECL_TEMPLATE(freebsd, sys_sigfastblock) // 573
DECL_TEMPLATE(freebsd, sys___realpathat) // 574
-#endif
DECL_TEMPLATE(freebsd, sys_close_range) // 575
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_0)
-
// unimpl __NR_rpctls_syscall 576
DECL_TEMPLATE(freebsd, sys___specialfd) // 577
DECL_TEMPLATE(freebsd, sys_aio_writev) // 578
DECL_TEMPLATE(freebsd, sys_aio_readv) // 579
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_1)
-
-#if (FREEBSD_VERS >= FREEBSD_14_0)
// there was a hole in the numbering
+// __FreeBSD_version 1400030
DECL_TEMPLATE(freebsd, sys_fspacectl) // 580
-#endif
+
// unimpl __NR_sched_getcpu 581
DECL_TEMPLATE(freebsd, sys_swapoff) // 582
-#endif
-#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3)
DECL_TEMPLATE(freebsd, sys_kqueuex) // 583
DECL_TEMPLATE(freebsd, sys_membarrier) // 584
-#endif
-#if (FREEBSD_VERS >= FREEBSD_14_0) || (FREEBSD_VERS >= FREEBSD_13_4)
DECL_TEMPLATE(freebsd, sys_timerfd_create) // 585
DECL_TEMPLATE(freebsd, sys_timerfd_gettime) // 586
DECL_TEMPLATE(freebsd, sys_timerfd_settime) // 587
-#endif
-#if (FREEBSD_VERS >= FREEBSD_14_1) || (FREEBSD_VERS >= FREEBSD_13_4)
+// __FreeBSD_version 1400507 and 1500012
DECL_TEMPLATE(freebsd, sys_kcmp) // 588
-#endif
DECL_TEMPLATE(freebsd, sys_fake_sigreturn)
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
}
-#if (FREEBSD_VERS >= FREEBSD_12)
-
// SYS_cpuset_getdomain 561
// int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id,
// size_t setsize, domainset_t *mask, int *policy);
PRE_MEM_READ( "cpuset_getdomain(mask)", ARG5, ARG4 );
}
-#endif
-
PRE(sys_fake_sigreturn)
{
ThreadState* tst;
PRE_MEM_RASCIIZ("mknodat(pathname)", ARG2);
}
-#if (FREEBSD_VERS >= FREEBSD_12)
-
// SYS_cpuset_getdomain 561
// int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id,
// size_t setsize, domainset_t *mask, int *policy);
PRE_MEM_READ("cpuset_getdomain(mask)", ARG5, ARG4);
}
-#endif
-
PRE(sys_fake_sigreturn)
{
ThreadState* tst;
}
}
-// freebsd6_pread 173 FREEBSD_VERS <= 10
+// freebsd6_pread 173 FreeBSD 10 and earlier
// x86/amd64
-// freebsd6_pwrite 174 FREEBSD_VERS <= 10
+// freebsd6_pwrite 174 FreeBSD 10 and earlier
// x86/amd64
// SYS_setfib 175
PRE_REG_READ1(long, "seteuid", vki_uid_t, uid);
}
-
-#if (FREEBSD_VERS >= FREEBSD_12)
-
// SYS_freebsd11_stat 188
// int stat(char *path, struct freebsd11_stat *sb);
PRE(sys_freebsd11_stat)
}
}
-#else
-
-PRE(sys_stat)
-{
- PRINT("sys_stat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(int, "stat", char *, path, struct stat *, sb);
- PRE_MEM_RASCIIZ( "stat(path)", ARG1 );
- PRE_MEM_WRITE( "stat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-POST(sys_stat)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-
-PRE(sys_fstat)
-{
- PRINT("sys_fstat ( %" FMT_REGWORD "d, %#" FMT_REGWORD "x )",SARG1,ARG2);
- PRE_REG_READ2(int, "fstat", int, fd, struct stat *, sb);
- PRE_MEM_WRITE( "fstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-POST(sys_fstat)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-PRE(sys_lstat)
-{
- PRINT("sys_lstat ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(int, "lstat", const char *, path, struct stat *, sb);
- PRE_MEM_RASCIIZ( "lstat(path)", ARG1 );
- PRE_MEM_WRITE( "lstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-POST(sys_lstat)
-{
- vg_assert(SUCCESS);
- if (RES == 0) {
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_stat) );
- }
-}
-
-#endif
-
// SYS_pathconf 191
// long pathconf(const char *path, int name);
PRE(sys_pathconf)
// SYS_freebsd11_getdirentries 196
// int getdirentries(int fd, char *buf, int nbytes, long *basep);
-#if (FREEBSD_VERS >= FREEBSD_12)
PRE(sys_freebsd11_getdirentries)
{
*flags |= SfMayBlock;
}
}
}
-#else
-PRE(sys_getdirentries)
-{
- *flags |= SfMayBlock;
- PRINT("sys_getdirentries ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u )", ARG1,ARG2,ARG3);
- PRE_REG_READ4(int, "getdirentries",
- int, fd, char *, buf,
- int, nbytes,
- long *, basep);
- PRE_MEM_WRITE( "getdirentries(buf)", ARG2, ARG3 );
- if (ARG4)
- PRE_MEM_WRITE( "getdirentries(basep)", ARG4, sizeof(long) );
-}
-
-POST(sys_getdirentries)
-{
- vg_assert(SUCCESS);
- if (RES > 0) {
- POST_MEM_WRITE( ARG2, RES );
- if ( ARG4 != 0 )
- POST_MEM_WRITE( ARG4, sizeof (long));
- }
-}
-#endif
// SYS_freebsd6_mmap 197
// amd64 / x86
// SYS___syscall 198
// special handling
-// freebsd6_lseek 199 FREEBSD_VERS <= 10
+// freebsd6_lseek 199 FreeBSD 10 and earlier
// x86/amd64
-// freebsd6_truncate 200 FREEBSD_VERS <= 10
+// freebsd6_truncate 200 FreeBSD 10 and earlier
// x86/amd64
-// freebsd6_ftruncate 201 FREEBSD_VERS <= 10
+// freebsd6_ftruncate 201 FreeBSD 10 and earlier
// x86/amd64
static Bool sysctl_kern_ps_strings(SizeT* out, SizeT* outlen)
// SYS_freebsd11_fhstat 299
// int fhstat(const fhandle_t *fhp, struct stat *sb);
-#if (FREEBSD_VERS >= FREEBSD_12)
PRE(sys_freebsd11_fhstat)
{
PRINT("sys_freebsd11_fhstat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
{
POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_stat) );
}
-#else
-PRE(sys_fhstat)
-{
- PRINT("sys_fhstat ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fhstat", struct fhandle *, fhp, struct stat *, sb);
- PRE_MEM_READ( "fhstat(fhp)", ARG1, sizeof(struct vki_fhandle) );
- PRE_MEM_WRITE( "fhstat(sb)", ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-POST(sys_fhstat)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_stat) );
-}
-
-#endif
// SYS_modnext 300
// int modnext(int modid);
// int kevent(int kq, const struct kevent *changelist, int nchanges,
// struct kevent *eventlist, int nevents,
// const struct timespec *timeout);
-#if (FREEBSD_VERS >= FREEBSD_12)
PRE(sys_freebsd11_kevent)
{
PRINT("sys_freebsd11_kevent ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )\n", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
}
}
}
-#else
-PRE(sys_kevent)
-{
- *flags |= SfMayBlock;
- PRINT("sys_kevent ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %#" FMT_REGWORD "x )\n", ARG1,ARG2,ARG3,ARG4,ARG5,ARG6);
- PRE_REG_READ6(int, "kevent",
- int, fd, struct vki_kevent_freebsd11 *, changelist, int, nchanges,
- struct vki_kevent_freebsd11 *, eventlist, int, nevents,
- struct timespec *, timeout);
- if (ARG2 != 0 && ARG3 != 0)
- PRE_MEM_READ( "kevent(changelist)", ARG2, sizeof(struct vki_kevent_freebsd11)*ARG3 );
- if (ARG4 != 0 && ARG5 != 0)
- PRE_MEM_WRITE( "kevent(eventlist)", ARG4, sizeof(struct vki_kevent_freebsd11)*ARG5);
- if (ARG6 != 0)
- PRE_MEM_READ( "kevent(timeout)",
- ARG6, sizeof(struct vki_timespec));
-}
-
-POST(sys_kevent)
-{
- vg_assert(SUCCESS);
- if ((Word)RES != -1) {
- if (ARG4 != 0)
- POST_MEM_WRITE( ARG4, sizeof(struct vki_kevent_freebsd11)*RES) ;
- }
-}
-#endif
// SYS_extattr_set_fd 371
// ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname,
// SYS_mac_syscall 394
// @todo
-#if (FREEBSD_VERS >= FREEBSD_12)
-
// SYS_freebsd11_getfsstat 395
// int getfsstat(struct freebsd11_statfs *buf, long bufsize, int mode);
-
PRE(sys_freebsd11_getfsstat)
{
PRINT("sys_freebsd11_getfsstat ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3);
POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_statfs) );
}
-
-#else
-
-PRE(sys_getfsstat)
-{
- PRINT("sys_getfsstat ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u, %" FMT_REGWORD "u )",ARG1,ARG2,ARG3);
- PRE_REG_READ3(int, "getfsstat", struct vki_freebsd11_statfs *, buf, long, bufsize, int, mode);
- PRE_MEM_WRITE( "getfsstat(buf)", ARG1, ARG2 );
-}
-
-POST(sys_getfsstat)
-{
- vg_assert(SUCCESS);
- if ((Word)RES != -1) {
- POST_MEM_WRITE( ARG1, RES * sizeof(struct vki_freebsd11_statfs) );
- }
-}
-
-PRE(sys_statfs)
-{
- PRINT("sys_statfs ( %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )",ARG1,(char *)ARG1,ARG2);
- PRE_REG_READ2(int, "statfs", const char *, path, struct statfs *, buf);
- PRE_MEM_RASCIIZ( "statfs(path)", ARG1 );
- PRE_MEM_WRITE( "statfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-POST(sys_statfs)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-PRE(sys_fstatfs)
-{
- PRINT("sys_fstatfs ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fstatfs",
- unsigned int, fd, struct statfs *, buf);
- PRE_MEM_WRITE( "fstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-POST(sys_fstatfs)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-PRE(sys_fhstatfs)
-{
- PRINT("sys_fhstatfs ( %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )",ARG1,ARG2);
- PRE_REG_READ2(int, "fhstatfs",
- struct fhandle *, fhp, struct statfs *, buf);
- PRE_MEM_READ( "fhstatfs(fhp)", ARG1, sizeof(struct vki_fhandle) );
- PRE_MEM_WRITE( "fhstatfs(buf)", ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-POST(sys_fhstatfs)
-{
- POST_MEM_WRITE( ARG2, sizeof(struct vki_freebsd11_statfs) );
-}
-
-
-#endif
-
// SYS_ksem_close 400
// @todo
}
}
-#if (FREEBSD_VERS >= FREEBSD_13_1)
// SYS_freebsd13_swapoff 424
// int swapoff(const char *special);
PRE(sys_freebsd13_swapoff)
PRE_REG_READ1(int, "swapoff", const char *, special);
PRE_MEM_RASCIIZ( "swapoff(special)", ARG1 );
}
-#else
-// SYS_swapoff 424
-// int swapoff(const char *special);
-PRE(sys_swapoff)
-{
- PRINT("sys_swapoff ( %#" FMT_REGWORD "x(%s) )", ARG1,(char *)ARG1);
- PRE_REG_READ1(int, "swapoff", const char *, special);
- PRE_MEM_RASCIIZ( "swapoff(special)", ARG1 );
-}
-#endif
// SYS___acl_get_link 425
// int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp);
void*, obj, int, op, unsigned long, val, struct umtx_robust_lists*, uaddr);
PRE_MEM_READ( "_umtx_op_robust_lists(robust_lists)", ARG4, ARG3 );
break;
-#if (FREEBSD_VERS >= FREEBSD_13_3)
case VKI_UMTX_OP_GET_MIN_TIMEOUT:
PRINT( "sys__umtx_op ( GET_MIN_TIMEOUT, %#" FMT_REGWORD "x)", ARG4);
// bit of a pain just reads args 2 and 4
PRA3("_umtx_op_set_min_timeout",unsigned long,timeout);
}
break;
-#endif
default:
VG_(umsg)("WARNING: _umtx_op unsupported value.\n");
PRINT( "sys__umtx_op ( %#" FMT_REGWORD "x, %" FMT_REGWORD "u(UNKNOWN), %" FMT_REGWORD "u, %#" FMT_REGWORD "x, %#" FMT_REGWORD "x )", ARG1, ARG2, ARG3, ARG4, ARG5);
break;
case VKI_UMTX_OP_ROBUST_LISTS:
break;
-#if (FREEBSD_VERS >= FREEBSD_13_3)
case VKI_UMTX_OP_GET_MIN_TIMEOUT:
POST_MEM_WRITE( ARG4, sizeof(long int) );
break;
case VKI_UMTX_OP_SET_MIN_TIMEOUT:
break;
-#endif
default:
break;
}
// SYS_freebsd11_fstatat 493
// int fstatat(int fd, const char *path, struct stat *sb, int flag);
-#if (FREEBSD_VERS >= FREEBSD_12)
PRE(sys_freebsd11_fstatat)
{
PRINT("sys_freebsd11_fstatat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3);
{
POST_MEM_WRITE( ARG3, sizeof(struct vki_freebsd11_stat) );
}
-#else
-PRE(sys_fstatat)
-{
- PRINT("sys_fstatat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), %#" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3);
- PRE_REG_READ4(int, "fstatat",
- int, fd, const char *, path, struct stat *, buf, int, flag);
- PRE_MEM_RASCIIZ( "fstatat(path)", ARG2 );
- PRE_MEM_WRITE( "fstatat(sb)", ARG3, sizeof(struct vki_freebsd11_stat) );
-}
-
-POST(sys_fstatat)
-{
- POST_MEM_WRITE( ARG3, sizeof(struct vki_freebsd11_stat) );
-}
-#endif
// SYS_futimesat 494
// int futimesat(int fd, const char *path, const struct timeval times[2]);
// SYS_freebsd11_mknodat 498
// int mknodat(int fd, const char *path, mode_t mode, dev_t dev);
-#if (FREEBSD_VERS >= FREEBSD_12)
PRE(sys_freebsd11_mknodat)
{
PRINT("sys_freebsd11_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 );
int, dfd, const char *, pathname, int, mode, unsigned, dev);
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
}
-#else
-PRE(sys_mknodat)
-{
- PRINT("sys_mknodat ( %" FMT_REGWORD "u, %#" FMT_REGWORD "x(%s), 0x%" FMT_REGWORD "x, 0x%" FMT_REGWORD "x )", ARG1,ARG2,(char*)ARG2,ARG3,ARG4 );
- PRE_REG_READ4(long, "mknodat",
- int, dfd, const char *, pathname, int, mode, unsigned, dev);
- PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
-}
-#endif
// SYS_openat 499
// int openat(int fd, const char *path, int flags, ...);
PRE_REG_READ1(int, "fdatasync", int, fd);
}
-#if (FREEBSD_VERS >= FREEBSD_12)
// SYS_fstat 551
// int fstat(int fd, struct stat *sb);
PRE(sys_fstat)
POST_MEM_WRITE(ARG2, ARG3);
}
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_12_2)
-
// SYS_unlinkat 568
// int funlinkat(int dfd, const char *path, int fd, int flag);
PRE(sys_funlinkat)
}
}
-
// SYS___sysctlbyname 570
// int sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
// const void *newp, size_t newlen);
}
}
-#endif // (FREEBSD_VERS >= FREEBSD_12_2)
-
-#if (FREEBSD_VERS >= FREEBSD_13_0)
-
// SYS_shm_open2 571
// from syscalls.master
// int shm_open2(_In_z_ const char *path,
POST_MEM_WRITE((Addr)ARG3, ARG4);
}
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_12_2)
-
// SYS_sys_close_range 575
// int close_range(u_int lowfd, u_int highfd, int flags);
PRE(sys_close_range)
ML_(record_fd_close)(tid, fd);
}
}
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_0)
// SYS___specialfd 577
// syscalls.master
}
}
-#endif // (FREEBSD_VERS >= FREEBSD_13_0)
-
-#if (FREEBSD_VERS >= FREEBSD_13_1)
-
-#if (FREEBSD_VERS >= FREEBSD_14_0)
// SYS_fspacectl 580
// int fspacectl(int fd, int cmd, const struct spacectl_range *rqsr, int flags,
// struct spacectl_range *rmsr);
POST_MEM_WRITE((Addr)ARG5, sizeof(struct vki_spacectl_range));
}
}
-#endif
// SYS_swapoff 582
// int swapoff(const char *special, u_int flags);
PRE_MEM_RASCIIZ( "swapoff(special)", ARG1 );
}
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3)
-
// SYS_kqueuex 583
// int kqueuex(u_int flags);
PRE(sys_kqueuex)
PRE_REG_READ3(int, "membarrier", int, cmd, unsigned, flags, int, cpu_id);
}
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_14_0) || (FREEBSD_VERS >= FREEBSD_13_4)
-
// SYS_timerfd_create 585
// int timerfd_create(int clockid, int flags);
PRE(sys_timerfd_create)
}
}
-#endif // FREEBSD_14_0 or FREEDSD_13_4
-
-#if (FREEBSD_VERS >= FREEBSD_14_1) || (FREEBSD_VERS >= FREEBSD_13_4)
-
// SYS_kcmp 588
// int kcmp(pid_t pid1, pid_t pid2, int type, uintptr_t idx1, uintptr_t idx2);
PRE(sys_kcmp)
}
}
-#endif // FREEBSD_14_1 or FREEDSD_13_4
-
#undef PRE
#undef POST
// obs lfs_segclean 186
// obs lfs_segwait 187
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_freebsd11_stat, sys_freebsd11_stat), // 188
BSDXY(__NR_freebsd11_fstat, sys_freebsd11_fstat), // 189
BSDXY(__NR_freebsd11_lstat, sys_freebsd11_lstat), // 190
-#else
- BSDXY(__NR_stat, sys_stat), // 188
- BSDXY(__NR_fstat, sys_fstat), // 189
- BSDXY(__NR_lstat, sys_lstat), // 190
-#endif
+
BSDX_(__NR_pathconf, sys_pathconf), // 191
BSDX_(__NR_fpathconf, sys_fpathconf), // 192
GENXY(__NR_getrlimit, sys_getrlimit), // 194
GENX_(__NR_setrlimit, sys_setrlimit), // 195
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_freebsd11_getdirentries, sys_freebsd11_getdirentries), // 196
-#else
- BSDXY(__NR_getdirentries, sys_getdirentries), // 196
-#endif
+
//BSDX_(__NR_freebsd6_mmap, sys_freebsd6_mmap), // 197
// __syscall (handled specially) // 198
//BSDX_(__NR_freebsd6_lseek, sys_freebsd6_lseek), // 199
// freebsd 4 fhstatfs 297
BSDXY(__NR_fhopen, sys_fhopen), // 298
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_freebsd11_fhstat, sys_freebsd11_fhstat), // 299
-#else
- BSDXY(__NR_fhstat, sys_fhstat), // 299
-#endif
BSDX_(__NR_modnext, sys_modnext), // 300
BSDXY(__NR_modstat, sys_modstat), // 301
BSDXY(__NR_getresuid, sys_getresuid), // 360
BSDXY(__NR_getresgid, sys_getresgid), // 361
BSDXY(__NR_kqueue, sys_kqueue), // 362
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200033
BSDXY(__NR_freebsd11_kevent, sys_freebsd11_kevent), // 363
-#else
- BSDXY(__NR_kevent, sys_kevent), // 363
-#endif
// obs __cap_get_proc 364
// obs __cap_set_proc 365
// obs __cap_get_fd 366
BSDXY(__NR_sendfile, sys_sendfile), // 393
// unimpl mac_syscall 394
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_freebsd11_getfsstat, sys_freebsd11_getfsstat), // 395
BSDXY(__NR_freebsd11_statfs, sys_statfs), // 396
BSDXY(__NR_freebsd11_fstatfs, sys_fstatfs), // 397
BSDXY(__NR_freebsd11_fhstatfs, sys_fhstatfs), // 398
-#else
- BSDXY(__NR_getfsstat, sys_getfsstat), // 395
- BSDXY(__NR_statfs, sys_statfs), // 396
- BSDXY(__NR_fstatfs, sys_fstatfs), // 397
- BSDXY(__NR_fhstatfs, sys_fhstatfs), // 398
-#endif
// unimpl ksem_close 400
// unimpl ksem_post 401
BSDX_(__NR_setcontext, sys_setcontext), // 422
BSDXY(__NR_swapcontext, sys_swapcontext), // 423
-#if (FREEBSD_VERS >= FREEBSD_13_1)
BSDX_(__NR_freebsd13_swapoff, sys_freebsd13_swapoff), // 424
-#else
- BSDX_(__NR_swapoff, sys_swapoff), // 424
-#endif
BSDXY(__NR___acl_get_link, sys___acl_get_link), // 425
BSDX_(__NR___acl_set_link, sys___acl_set_link), // 426
BSDX_(__NR___acl_delete_link, sys___acl_delete_link), // 427
BSDX_(__NR_fchownat, sys_fchownat), // 491
BSDX_(__NR_fexecve, sys_fexecve), // 492
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_freebsd11_fstatat, sys_freebsd11_fstatat), // 493
-#else
- BSDXY(__NR_fstatat, sys_fstatat), // 493
-#endif
BSDX_(__NR_futimesat, sys_futimesat), // 494
BSDX_(__NR_linkat, sys_linkat), // 495
BSDX_(__NR_mkdirat, sys_mkdirat), // 496
BSDX_(__NR_mkfifoat, sys_mkfifoat), // 497
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDX_(__NR_freebsd11_mknodat, sys_freebsd11_mknodat), // 498
-#else
- BSDX_(__NR_mknodat, sys_mknodat), // 498
-#endif
BSDXY(__NR_openat, sys_openat), // 499
// 547 is the highest syscall on FreeBSD 10
-#if (FREEBSD_VERS >= FREEBSD_11)
-
/* 548 is obsolete numa_getaffinity */
/* 549 is obsolete numa_setaffinity */
BSDX_(__NR_fdatasync, sys_fdatasync), // 550
-#endif // FREEBSD_VERS >= FREEBSD_11
-
-#if (FREEBSD_VERS >= FREEBSD_12)
+ // __FreeBSD_version 1200031
BSDXY(__NR_fstat, sys_fstat), // 551
BSDXY(__NR_fstatat, sys_fstatat), // 552
BSDXY(__NR_fhstat, sys_fhstat), // 553
BSDXY(__NR_getfsstat, sys_getfsstat), // 557
BSDXY(__NR_fhstatfs, sys_fhstatfs), // 558
BSDX_(__NR_mknodat, sys_mknodat), // 559
+
+ // __FreeBSD_version 1200033
BSDXY(__NR_kevent, sys_kevent), // 560
+
BSDXY(__NR_cpuset_getdomain, sys_cpuset_getdomain), // 561
BSDX_(__NR_cpuset_setdomain, sys_cpuset_setdomain), // 562
BSDXY(__NR_getrandom, sys_getrandom), // 563
+
+ // __FreeBSD_version 1200031
BSDXY(__NR_getfhat, sys_getfhat), // 564
BSDX_(__NR_fhlink, sys_fhlink), // 565
BSDX_(__NR_fhlinkat, sys_fhlinkat), // 566
BSDXY(__NR_fhreadlink, sys_fhreadlink), // 567
-#endif // FREEBSD_VERS >= FREEBSD_12
-#if (FREEBSD_VERS >= FREEBSD_12_2)
BSDX_(__NR_funlinkat, sys_funlinkat), // 568
BSDX_(__NR_copy_file_range, sys_copy_file_range), // 569
+ // __FreeBSD_version 1201522 and 1300045
BSDXY(__NR___sysctlbyname, sys___sysctlbyname), // 570
-#if (FREEBSD_VERS >= FREEBSD_13_0)
BSDXY(__NR_shm_open2, sys_shm_open2), // 571
// unimpl __NR_shm_rename 572
BSDX_(__NR_sigfastblock, sys_sigfastblock), // 573
BSDXY( __NR___realpathat, sys___realpathat), // 574
-#endif
BSDXY(__NR_close_range, sys_close_range), // 575
-#endif
-#if (FREEBSD_VERS >= FREEBSD_13_0)
// unimpl __NR_rpctls_syscall 576
BSDX_(__NR___specialfd, sys___specialfd), // 577
BSDX_(__NR_aio_writev, sys_aio_writev), // 578
BSDXY(__NR_aio_readv, sys_aio_readv), // 579
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_1)
-#if (FREEBSD_VERS >= FREEBSD_14_0)
BSDXY(__NR_fspacectl, sys_fspacectl), // 580
-#endif
// unimpl __NR_sched_getcpu 581
BSDX_(__NR_swapoff, sys_swapoff), // 582
-#endif
-#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3)
BSDXY(__NR_kqueuex, sys_kqueuex), // 583
BSDX_(__NR_membarrier, sys_membarrier), // 584
-#endif
-#if (FREEBSD_VERS >= FREEBSD_14_0) || (FREEBSD_VERS >= FREEBSD_13_4)
BSDXY(__NR_timerfd_create, sys_timerfd_create), // 585
BSDXY(__NR_timerfd_settime, sys_timerfd_settime), // 586
BSDXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 587
-#endif
-#if (FREEBSD_VERS >= FREEBSD_14_1) || (FREEBSD_VERS >= FREEBSD_13_4)
BSDX_(__NR_kcmp, sys_kcmp), // 588
-#endif
-
-
BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn
PRE_MEM_RASCIIZ( "mknodat(pathname)", ARG2 );
}
-#if (FREEBSD_VERS >= FREEBSD_12)
-
// SYS_cpuset_getdomain 561
// int cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id,
// size_t setsize, domainset_t *mask, int *policy);
PRE_MEM_READ( "cpuset_getdomain(mask)", ARG6, ARG5 );
}
-#endif
-
PRE(sys_fake_sigreturn)
{
/* See comments on PRE(sys_rt_sigreturn) in syswrap-amd64-linux.c for
#if defined(VGO_freebsd)
// sysctlbyname, getosreldate, is32on64
extern Int VG_(sysctlbyname)(const HChar *name, void *oldp, SizeT *oldlenp, const void *newp, SizeT newlen);
-extern Int VG_(getosreldate)(void);
extern Bool VG_(is32on64)(void);
struct auxv {
#elif defined(VGO_freebsd)
-#if (FREEBSD_VERS >= FREEBSD_14_0)
-
void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void);
void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void)
{
return (void*)result;
}
-#endif
-
#elif defined(VGO_solaris)
/* Declare the errno and environ symbols weakly in case the client is not
#if defined(VGO_freebsd)
#include <dlfcn.h>
+#include <osreldate.h>
#endif
#if defined(VGO_solaris)
* is neither. So we force loading of libthr.so, which
* avoids this junk tid value.
*/
-#if (FREEBSD_VERS >= FREEBSD_15)
+#if (__FreeBSD_version >= 1500013)
void* libsys = dlopen("/lib/libsys.so.7", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE);
#endif
dlclose(dlopen("/lib/libthr.so.3", RTLD_NOW|RTLD_GLOBAL|RTLD_NODELETE));
-#if (FREEBSD_VERS >= FREEBSD_15)
+#if (__FreeBSD_version >= 1500013)
if (libsys) {
dlclose(libsys);
}
(action at startup) vgdb me ...
Test 1: Invalid write of size 4
at 0x........: test1 (faultstatus.c:121)
- by 0x........: main (faultstatus.c:188)
+ by 0x........: main (faultstatus.c:184)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
PASS
Test 2: PASS
(action at startup) vgdb me ...
Test 1: Invalid write of size 4
at 0x........: test1 (faultstatus.c:121)
- by 0x........: main (faultstatus.c:188)
+ by 0x........: main (faultstatus.c:184)
Address 0x........ is not stack'd, malloc'd or (recently) free'd
PASS
Test 2: PASS
/* Complain if this thread holds any locks. */
nHeld = HG_(cardinalityWS)( univ_lsets, thr_q->locksetA );
tl_assert(nHeld >= 0);
-#if !defined(VGO_freebsd) || (FREEBSD_VERS < FREEBSD_15)
- if (nHeld > 0) {
+ Bool lock_at_exit = False;
+#if defined(VGO_freebsd)
+ /* Bugzilla 494337
+ * temporary (?): turn off this check on FreeBSD 15+
+ * there is a lock during exit() to make it thread safe
+ * but that lock gets leaked.
+ */
+ if (VG_(getosreldate)() > 1500000) {
+ lock_at_exit = True;
+ }
+#endif
+ if (nHeld > 0 && (lock_at_exit == False)) {
HChar buf[80];
VG_(sprintf)(buf, "Exiting thread still holds %d lock%s",
nHeld, nHeld > 1 ? "s" : "");
HG_(record_error_Misc)( thr_q, buf );
}
-#endif
/* Not much to do here:
- tell libhb the thread is gone
typedef void (*vg_atfork_t)(ThreadId);
extern void VG_(atfork)(vg_atfork_t pre, vg_atfork_t parent, vg_atfork_t child);
+#if defined(VGO_freebsd)
+extern Int VG_(getosreldate)(void);
+#endif
+
#endif // __PUB_TOOL_LIBCPROC_H
#define VKI_UMTX_OP_SEM2_WAKE 24
#define VKI_UMTX_OP_SHM 25
#define VKI_UMTX_OP_ROBUST_LISTS 26
-
-#define VKI_UMTX_SHM_CREAT 0x0001
-
-#if (FREEBSD_VERS >= FREEBSD_13_3)
#define VKI_UMTX_OP_GET_MIN_TIMEOUT 27
#define VKI_UMTX_OP_SET_MIN_TIMEOUT 28
-#endif
+#define VKI_UMTX_SHM_CREAT 0x0001
//----------------------------------------------------------------------
// From sys/acl.h
#define __NR_setegid 182
#define __NR_seteuid 183
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_stat 188
#define __NR_freebsd11_fstat 189
#define __NR_freebsd11_lstat 190
-#else
-#define __NR_stat 188
-#define __NR_fstat 189
-#define __NR_lstat 190
-#endif
#define __NR_pathconf 191
#define __NR_fpathconf 192
#define __NR_getrlimit 194
#define __NR_setrlimit 195
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_getdirentries 196
-#else
-#define __NR_getdirentries 196
-#endif
//#define __NR_freebsd6_mmap 197
#define __NR___syscall 198
/* #define __NR_freebsd6_lseek 199 */
#define __NR_poll 209
#if !defined(VGP_arm64_freebsd)
#define __NR_freebsd7___semctl 220
-#endif
+#endif // VGP_arm64_freebsd
#define __NR_semget 221
#define __NR_semop 222
/* obs semconfig 223 */
#if !defined(VGP_arm64_freebsd)
#define __NR_freebsd7_msgctl 224
-#endif
+#endif // VGP_arm64_freebsd
#define __NR_msgget 225
#define __NR_msgsnd 226
#define __NR_msgrcv 227
#define __NR_shmat 228
#if !defined(VGP_arm64_freebsd)
#define __NR_freebsd7_shmctl 229
-#endif
+#endif // VGP_arm64_freebsd
#define __NR_shmdt 230
#define __NR_shmget 231
#define __NR_clock_gettime 232
#define __NR_lutimes 276
/* obs netbsd_msync 277 */
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_nstat 278
#define __NR_freebsd11_nfstat 279
#define __NR_freebsd11_nlstat 280
-#else
-#define __NR_nstat 278
-#define __NR_nfstat 279
-#define __NR_nlstat 280
-#endif
+
#define __NR_preadv 289
#define __NR_pwritev 290
#define __NR_fhopen 298
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_fhstat 299
-#else
-#define __NR_fhstat 299
-#endif
#define __NR_modnext 300
#define __NR_modstat 301
#define __NR_getresgid 361
#define __NR_kqueue 362
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200033
#define __NR_freebsd11_kevent 363
-#else
-#define __NR_kevent 363
-#endif
+
/* obs __cap_get_proc 364 */
/* obs __cap_set_proc 365 */
/* obs __cap_get_fd 366 */
#define __NR_sendfile 393
#define __NR_mac_syscall 394
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_getfsstat 395
#define __NR_freebsd11_statfs 396
#define __NR_freebsd11_fstatfs 397
#define __NR_freebsd11_fhstatfs 398
-#else
-#define __NR_getfsstat 395
-#define __NR_statfs 396
-#define __NR_fstatfs 397
-#define __NR_fhstatfs 398
-#endif
#define __NR_ksem_close 400
#define __NR_ksem_post 401
#define __NR_getcontext 421
#define __NR_setcontext 422
#define __NR_swapcontext 423
-#if (FREEBSD_VERS >= FREEBSD_13_1)
#define __NR_freebsd13_swapoff 424
-#else
-#define __NR_swapoff 424
-#endif
#define __NR___acl_get_link 425
#define __NR___acl_set_link 426
#define __NR___acl_delete_link 427
#define __NR_fchownat 491
#define __NR_fexecve 492
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_fstatat 493
-#else
-#define __NR_fstatat 493
-#endif
#define __NR_futimesat 494
#define __NR_linkat 495
#define __NR_mkdirat 496
#define __NR_mkfifoat 497
-#if (FREEBSD_VERS >= FREEBSD_12)
+// __FreeBSD_version 1200031
#define __NR_freebsd11_mknodat 498
-#else
-#define __NR_mknodat 498
-#endif
#define __NR_openat 499
#define __NR_readlinkat 500
/* obs numa_getaffinity 548 */
/* obs numa_setaffinity 549 */
-#if (FREEBSD_VERS >= FREEBSD_11)
-
#define __NR_fdatasync 550
-#endif // (FREEBSD_VERS >= FREEBSD_11)
-
-#if (FREEBSD_VERS >= FREEBSD_12)
-
+// __FreeBSD_version 1200031
#define __NR_fstat 551
#define __NR_fstatat 552
#define __NR_fhstat 553
#define __NR_getfsstat 557
#define __NR_fhstatfs 558
#define __NR_mknodat 559
+
+// __FreeBSD_version 1200033
#define __NR_kevent 560
+
#define __NR_cpuset_getdomain 561
#define __NR_cpuset_setdomain 562
#define __NR_getrandom 563
+
+// __FreeBSD_version 1200031
#define __NR_getfhat 564
#define __NR_fhlink 565
#define __NR_fhlinkat 566
#define __NR_fhreadlink 567
-#endif // (FREEBSD_VERS >= FREEBSD_12)
-
-#if (FREEBSD_VERS >= FREEBSD_12_2)
-
+// __FreeBSD_version 1300018
#define __NR_funlinkat 568
#define __NR_copy_file_range 569
+// __FreeBSD_version 1201522 and 1300045
#define __NR___sysctlbyname 570
-#if (FREEBSD_VERS >= FREEBSD_13_0)
#define __NR_shm_open2 571
#define __NR_shm_rename 572
#define __NR_sigfastblock 573
+// __FreeBSD_version 1300080
#define __NR___realpathat 574
-#endif
+// __FreeBSD_version 1300091
#define __NR_close_range 575
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_0)
-
#define __NR_rpctls_syscall 576
#define __NR___specialfd 577
#define __NR_aio_writev 578
#define __NR_aio_readv 579
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_13_1)
-
-#if (FREEBSD_VERS >= FREEBSD_14_0)
+// __FreeBSD_version 1400030
#define __NR_fspacectl 580
-#endif
#define __NR_sched_getcpu 581
#define __NR_swapoff 582
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3)
-
#define __NR_kqueuex 583
#define __NR_membarrier 584
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_14_0) || (FREEBSD_VERS >= FREEBSD_13_4)
-
#define __NR_timerfd_create 585
#define __NR_timerfd_gettime 586
#define __NR_timerfd_settime 587
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_14_1) || (FREEBSD_VERS >= FREEBSD_13_3)
-
+// __FreeBSD_version 1400507 and 1500012
#define __NR_kcmp 588
-#endif
-
#define __NR_fake_sigreturn 1000
#endif /* VKI_UNISTD_FREEBSD_H */
bug464476_SOURCES = bug464476.cpp
bug470713_SOURCES = bug470713.cpp
-if FREEBSD_VERS_13_PLUS
-check_PROGRAMS += realpathat scalar_13_plus eventfd1 eventfd2
+if FREEBSD_SYSCALL13
+check_PROGRAMS += scalar_13_plus
scalar_13_plus_CFLAGS = ${AM_CFLAGS} -g
endif
-if FREEBSD_VERS_15_PLUS
-check_PROGRAMS += kqueuex scalar_15_plus timerfd
-scalar_15_plus_CFLAGS = ${AM_CFLAGS} -g
+if FREEBSD_EVENTFD
+check_PROGRAMS += eventfd1 eventfd2
+endif
+
+if FREEBSD_REALPATHAT_SYSCALL
+check_PROGRAMS += realpathat
+endif
+
+if FREEBSD_KQUEUEX_SYSCALL
+check_PROGRAMS += kqueuex
+endif
+
+if FREEBSD_TIMERFD_SYSCALL
+check_PROGRAMS += timerfd
timerfd_LDFLAGS = -lm
endif
+if FREEBSD_SYSCALL15
+check_PROGRAMS += scalar_15_plus timerfd
+scalar_15_plus_CFLAGS = ${AM_CFLAGS} -g
+endif
+
aligned_alloc_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
delete_sized_mismatch_CXXFLAGS = ${AM_CXXFLAGS} --std=c++14
errno_aligned_allocs_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
+
extattr_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNUSED_BUT_SET_VARIABLE@
memalign_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_NON_POWER_OF_TWO_ALIGNMENT@
char path[PATH_MAX];
fhandle_t fh1;
fhandle_t fh2;
-#if (FREEBSD_VERS >= FREEBSD_12)
+#if (__FreeBSD_version >= 1200031)
fhandle_t fh3;
#endif
getfh(path, &fh1);
lgetfh(path, &fh2);
-#if (FREEBSD_VERS >= FREEBSD_12)
+#if (__FreeBSD_version >= 1200031)
getfhat(fd, path, &fh3, AT_SYMLINK_NOFOLLOW);
#endif
getfh(fn, pfh1);
lgetfh(fn, pfh1);
-#if (FREEBSD_VERS >= FREEBSD_12)
+#if (__FreeBSD_version >= 1200031)
getfhat(*pi+AT_FDCWD, fn, pfh1, *pi+AT_SYMLINK_NOFOLLOW);
#endif
memset(buff, 0, sizeof(buff));
sprintf(buff, "some data");
write(tmpfd, buff, strlen(buff)+1);
-#if (FREEBSD_VERS >= FREEBSD_11)
+#if defined(HAVE_FDATASYNC)
fdatasync(tmpfd);
#endif
close (tmpfd);
unlink(tmpfromfile);
int badint;
-#if (FREEBSD_VERS >= FREEBSD_11)
+#if defined(HAVE_FDATASYNC)
fdatasync(badint);
#endif
}
perror("uuidgen failed:");
}
-#if (FREEBSD_VERS >= FREEBSD_12)
+#if defined(HAVE_GETRANDOM)
char buf[100];
if (-1 == getrandom(buf, 100, GRND_NONBLOCK))
VALGRIND_MAKE_MEM_UNDEFINED(&badint, sizeof(int));
uuidgen(&s, badint);
-#if (FREEBSD_VERS >= FREEBSD_12)
+#if defined(HAVE_GETRANDOM)
badint = 100;
VALGRIND_MAKE_MEM_UNDEFINED(&badint, sizeof(int));
GO(SYS_fdatasync, "1s 0m");
SY(SYS_fdatasync, x0+99999999); FAIL;
-#if (FREEBSD_VERS >= FREEBSD_12)
-
+ // __FreeBSD_version 1200031
/* SYS_fstat 551 */
GO(SYS_fstat, "2s 1m");
SY(SYS_fstat, x0+99999999, x0+1); FAIL;
GO(SYS_mknodat, "4s 1m");
SY(SYS_mknodat, x0+999999, x0+1, x0, x0); FAIL;
+ // FreeBSD_version 1200033
/* SYS_kevent 560 */
GO(SYS_kevent, "6s 3m");
SY(SYS_kevent, x0+1, x0+2, x0+3, x0+4, x0+5, x0+6); FAIL;
GO(SYS_getrandom, "3s 1m");
SY(SYS_getrandom, x0+1, x0+1, x0); FAIL;
+ // __FreeBSD_version 1200031)
/* SYS_getfhat 564 */
GO(SYS_getfhat, "4s 2m");
SY(SYS_getfhat, x0, x0, x0, x0); FAIL;
GO(SYS_fhreadlink, "3s 2m");
SY(SYS_fhreadlink, x0+1, x0+1, x0+10);
-#endif
-
-#if (FREEBSD_VERS >= FREEBSD_12_2)
-
- /* SYS___sysctlbyname 570 */
+ // __FreeBSD_version 1201522
+ // __FreeBSD_version 1300045
+ /* SYS___sysctlbyname 570 */
GO(SYS___sysctlbyname, "(getoldlen) 3s 2m");
SY(SYS___sysctlbyname, x0, x0+1, NULL, x0+1, NULL, x0); FAIL;
GO(SYS___sysctlbyname, "(putnew) 4s 2m");
SY(SYS___sysctlbyname, x0, x0+1, NULL, NULL, x0+1, x0+2); FAIL;
-#endif
-
/* SYS_exit 1 */
GO(SYS_exit, "1s 0m");
SY(SYS_exit, x0); FAIL;
int main(void)
{
-#if (FREEBSD_VERS >= FREEBSD_13_0)
+#if defined(KERN_PS_STRINGS)
unsigned long ul_ps_strings;
struct ps_strings* v1;
struct ps_strings* v2;
* BUS_ADRERR is used for bus time out while BUS_OBJERR is translated
* from underlying codes FC_OBJERR (x86) or ASYNC_BERR (sparc).
*/
-#if defined(VGO_solaris) || (defined(VGO_freebsd) && (FREEBSD_VERS >= FREEBSD_12_2))
+#if defined(VGO_solaris) || defined(VGO_freebsd)
# define BUS_ERROR_SI_CODE BUS_OBJERR
#else
# define BUS_ERROR_SI_CODE BUS_ADRERR
#define T(n, sig, code, addr) { test##n, sig, code, addr }
T(1, SIGSEGV, SEGV_MAPERR, BADADDR),
T(2, SIGSEGV, SEGV_ACCERR, mapping),
-#if defined(VGO_freebsd) && (FREEBSD_VERS < FREEBSD_12_2)
- T(3, SIGSEGV, BUS_ERROR_SI_CODE, &mapping[FILESIZE+10]),
-#else
T(3, SIGBUS, BUS_ERROR_SI_CODE, &mapping[FILESIZE+10]),
-#endif
T(4, SIGFPE, DIVISION_BY_ZERO_SI_CODE, 0),
#undef T
};