]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: switch to FreeBSD 12 versions of syscalls for fstat etc
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 24 Jan 2023 19:38:26 +0000 (20:38 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 24 Jan 2023 19:41:15 +0000 (20:41 +0100)
This was a change that enabled 64bit inodes (ino64).

Also a couple of typos in READMEs.

README_DEVELOPERS
README_MISSING_SYSCALL_OR_IOCTL
coregrind/m_aspacemgr/aspacemgr-common.c
coregrind/m_libcfile.c
include/vki/vki-freebsd.h

index 86f539bb6ffba8c67414cf95044447e8ff7e63b4..6f7d1a9eee7cf4472a937d5a8a10899d264c1ae3 100644 (file)
@@ -136,7 +136,7 @@ A different and possibly easier way is as follows:
 
 (2) In a different shell, do "gdb /proc/<pid>/exe <pid>", where
     <pid> you read from the output printed by (1).  This attaches
-    GDB to the tool executable, which should be in the abovementioned
+    GDB to the tool executable, which should be in the above mentioned
     wait loop.
 
 (3) Do "cont" to continue.  After the loop finishes spinning, startup
index 0019951e753a5921fe107661d73afe1b5cdcf089..8ddced5c992d5feb7051396ac46534942cb9a60b 100644 (file)
@@ -19,7 +19,7 @@ What are syscall/ioctl wrappers?  What do they do?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 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
@@ -29,7 +29,7 @@ Syscall and ioctl wrappers have two jobs:
 
 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
index 282cc50d7030deb17a6e81e7960799109824cdc9..816d2274f464c920f3dac6b22c76e9e209ac97d6 100644 (file)
@@ -386,10 +386,11 @@ Bool ML_(am_get_fd_d_i_m)( Int fd,
    }
    return False;
 #  elif defined(VGO_freebsd)
+#if (FREEBSD_VERS < FREEBSD_12)
    struct vki_freebsd11_stat buf;
-#if (FREEBSD_VERS >= FREEBSD_12)
-   SysRes res = VG_(do_syscall2)(__NR_freebsd11_fstat, fd, (UWord)&buf);
+   SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
 #else
+   struct vki_stat buf;
    SysRes res = VG_(do_syscall2)(__NR_fstat, fd, (UWord)&buf);
 #endif
    if (!sr_isError(res)) {
index 84de11a5c877104932b97093323e0dbd272eda0a..aad0cb199c6581f2776685b4e4b7dfe04e56c162 100644 (file)
@@ -260,8 +260,13 @@ SysRes VG_(mknod) ( const HChar* pathname, Int mode, UWord dev )
    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);
@@ -556,11 +561,12 @@ SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* vgbuf )
    }
 #  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);
@@ -632,10 +638,11 @@ Int VG_(fstat) ( Int fd, struct vg_stat* vgbuf )
    }
 #  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)) {
@@ -655,11 +662,12 @@ SysRes VG_(lstat) ( const HChar* file_name, struct vg_stat* vgbuf )
    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);
index a7344242e9a488079723fa96e983fd801cb3a303..2bbaa441882599b0ee62bad5a7ea6952684a6406 100644 (file)
@@ -1558,6 +1558,8 @@ struct vki_dirent {
 #define VKI_O_SEARCH   O_EXEC
 
 #define VKI_AT_FDCWD            AT_FDCWD
+#define VKI_AT_SYMLINK_NOFOLLOW 0x0200
+
 
 #define VKI_F_DUPFD     0  /* dup */
 #define VKI_F_GETFD     1  /* get close_on_exec */