mirror of
git://sourceware.org/git/valgrind.git
synced 2026-01-12 00:19:31 +08:00
FreeBSD: switch to FreeBSD 12 versions of syscalls for fstat etc
This was a change that enabled 64bit inodes (ino64). Also a couple of typos in READMEs.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user