~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Valgrind does what it does, in part, by keeping track of everything your
program does. When a system call happens, for example a request to read
-part of a file, control passes to the Linux kernel, which fulfills the
+part of a file, control passes to the Linux kernel, which fulfils the
request, and returns control to your program. The problem is that the
kernel will often change the status of some part of your program's memory
as a result, and tools (instrumentation plug-ins) may need to know about
1. Tell a tool what's about to happen, before the syscall takes place. A
tool could perform checks beforehand, eg. if memory about to be written
- is actually writeable. This part is useful, but not strictly
+ is actually writable. This part is useful, but not strictly
essential.
2. Tell a tool what just happened, after a syscall takes place. This is
SysRes res = VG_(do_syscall3)(__NR_mknod,
(UWord)pathname, mode, dev);
# elif defined(VGO_freebsd)
+#if (FREEBSD_VERS < FREEBSD_12)
SysRes res = VG_(do_syscall3)(__NR_freebsd11_mknod,
(UWord)pathname, mode, dev);
+#else
+ SysRes res = VG_(do_syscall4)(__NR_mknodat, VKI_AT_FDCWD,
+ (UWord)pathname, mode, dev);
+#endif
# elif defined(VGO_solaris)
SysRes res = VG_(do_syscall4)(__NR_mknodat,
VKI_AT_FDCWD, (UWord)pathname, mode, dev);
}
# elif defined(VGO_freebsd)
{
+#if (FREEBSD_VERS < FREEBSD_12)
struct vki_freebsd11_stat buf;
-#if (FREEBSD_VERS >= FREEBSD_12)
- res = VG_(do_syscall2)(__NR_freebsd11_stat, (UWord)file_name, (UWord)&buf);
-#else
res = VG_(do_syscall2)(__NR_stat, (UWord)file_name, (UWord)&buf);
+#else
+ struct vki_stat buf;
+ res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, 0);
#endif
if (!sr_isError(res)) {
TRANSLATE_TO_vg_stat(vgbuf, &buf);
}
# elif defined(VGO_freebsd)
{
+#if (FREEBSD_VERS < FREEBSD_12)
struct vki_freebsd11_stat buf;
-#if (FREEBSD_VERS >= FREEBSD_12)
- res = VG_(do_syscall2)(__NR_freebsd11_fstat, (RegWord)fd, (RegWord)(Addr)&buf);
+ res = VG_(do_syscall2)(__NR_fstat, (RegWord)fd, (RegWord)(Addr)&buf);
#else
+ struct vki_stat buf;
res = VG_(do_syscall2)(__NR_fstat, (RegWord)fd, (RegWord)(Addr)&buf);
#endif
if (!sr_isError(res)) {
SysRes res;
VG_(memset)(vgbuf, 0, sizeof(*vgbuf));
+#if (FREEBSD_VERS < FREEBSD_12)
struct vki_freebsd11_stat buf;
-#if (FREEBSD_VERS >= FREEBSD_12)
- res = VG_(do_syscall2)(__NR_freebsd11_lstat, (UWord)file_name, (UWord)&buf);
-#else
res = VG_(do_syscall2)(__NR_lstat, (UWord)file_name, (UWord)&buf);
+#else
+ struct vki_stat buf;
+ res = VG_(do_syscall4)(__NR_fstatat, VKI_AT_FDCWD, (UWord)file_name, (UWord)&buf, VKI_AT_SYMLINK_NOFOLLOW);
#endif
if (!sr_isError(res)) {
TRANSLATE_TO_vg_stat(vgbuf, &buf);