mirror of
https://git.freebsd.org/ports.git
synced 2025-06-08 14:20:33 -04:00
241 lines
7.1 KiB
Text
241 lines
7.1 KiB
Text
From 6aaeefab2490d56743ec49d0e20d3fd6ff45fb55 Mon Sep 17 00:00:00 2001
|
|
From: Roman Bogorodskiy <bogorodskiy@gmail.com>
|
|
Date: Sat, 9 Sep 2017 18:27:15 +0400
|
|
Subject: [PATCH v2] ino64 support
|
|
|
|
---
|
|
coregrind/m_syswrap/priv_syswrap-freebsd.h | 4 ++
|
|
coregrind/m_syswrap/syswrap-freebsd.c | 65 ++++++++++++++++++++++++++++++
|
|
include/vki/vki-freebsd.h | 56 +++++++++++++++++++++++++
|
|
include/vki/vki-scnums-freebsd.h | 4 ++
|
|
4 files changed, 129 insertions(+)
|
|
|
|
diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h
|
|
index 63d122f..715ad48 100644
|
|
--- a/coregrind/m_syswrap/priv_syswrap-freebsd.h
|
|
+++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h
|
|
@@ -97,10 +97,12 @@ DECL_TEMPLATE(freebsd, sys_setegid);
|
|
DECL_TEMPLATE(freebsd, sys_seteuid);
|
|
DECL_TEMPLATE(freebsd, sys_stat);
|
|
DECL_TEMPLATE(freebsd, sys_fstat);
|
|
+DECL_TEMPLATE(freebsd, sys_fstat64);
|
|
DECL_TEMPLATE(freebsd, sys_lstat);
|
|
DECL_TEMPLATE(freebsd, sys_pathconf);
|
|
DECL_TEMPLATE(freebsd, sys_fpathconf);
|
|
DECL_TEMPLATE(freebsd, sys_getdirentries);
|
|
+DECL_TEMPLATE(freebsd, sys_getdirentries64);
|
|
DECL_TEMPLATE(freebsd, sys_mmap);
|
|
DECL_TEMPLATE(freebsd, sys___syscall);
|
|
DECL_TEMPLATE(freebsd, sys_lseek);
|
|
@@ -208,6 +210,7 @@ DECL_TEMPLATE(freebsd, sys_kevent);
|
|
DECL_TEMPLATE(freebsd, sys_sendfile);
|
|
DECL_TEMPLATE(freebsd, sys_statfs6);
|
|
DECL_TEMPLATE(freebsd, sys_fstatfs6);
|
|
+DECL_TEMPLATE(freebsd, sys_fstatfs64);
|
|
DECL_TEMPLATE(freebsd, sys_fhstatfs6);
|
|
DECL_TEMPLATE(freebsd, sys_thr_exit);
|
|
DECL_TEMPLATE(freebsd, sys_thr_self);
|
|
@@ -251,6 +254,7 @@ DECL_TEMPLATE(freebsd, sys_fchmodat);
|
|
DECL_TEMPLATE(freebsd, sys_fchownat);
|
|
DECL_TEMPLATE(freebsd, sys_fexecve);
|
|
DECL_TEMPLATE(freebsd, sys_fstatat);
|
|
+DECL_TEMPLATE(freebsd, sys_fstatat64);
|
|
DECL_TEMPLATE(freebsd, sys_futimesat);
|
|
DECL_TEMPLATE(freebsd, sys_linkat);
|
|
DECL_TEMPLATE(freebsd, sys_mkdirat);
|
|
diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c
|
|
index bf6b1f1..978e98e 100644
|
|
--- a/coregrind/m_syswrap/syswrap-freebsd.c
|
|
+++ b/coregrind/m_syswrap/syswrap-freebsd.c
|
|
@@ -885,6 +885,18 @@ POST(sys_fstat)
|
|
POST_MEM_WRITE( ARG2, sizeof(struct vki_stat) );
|
|
}
|
|
|
|
+PRE(sys_fstat64)
|
|
+{
|
|
+ PRINT("sys_fstat64 ( %ld, %#lx )", ARG1, ARG2);
|
|
+ PRE_REG_READ2(long, "fstat", unsigned long, fd, struct stat *, buf);
|
|
+ PRE_MEM_WRITE( "fstat(buf)", ARG2, sizeof(struct vki_stat64) );
|
|
+}
|
|
+
|
|
+POST(sys_fstat64)
|
|
+{
|
|
+ POST_MEM_WRITE( ARG2, sizeof(struct vki_stat64) );
|
|
+}
|
|
+
|
|
PRE(sys_pathconf)
|
|
{
|
|
PRINT("sys_pathconf ( %#lx(%s), %ld )",ARG1,(char *)ARG1,ARG2);
|
|
@@ -1029,6 +1041,26 @@ POST(sys_getdirentries)
|
|
}
|
|
}
|
|
|
|
+PRE(sys_getdirentries64)
|
|
+{
|
|
+ *flags |= SfMayBlock;
|
|
+ PRINT("sys_getdents ( %ld, %#lx, %ld )", ARG1,ARG2,ARG3);
|
|
+ PRE_REG_READ3(vki_ssize_t, "getdirentries",
|
|
+ unsigned int, fd, struct dirent *, dirp,
|
|
+ vki_size_t, count);
|
|
+ PRE_MEM_WRITE( "getdirentries(dirp)", ARG2, ARG3 );
|
|
+}
|
|
+
|
|
+POST(sys_getdirentries64)
|
|
+{
|
|
+ vg_assert(SUCCESS);
|
|
+ if (RES > 0) {
|
|
+ POST_MEM_WRITE( ARG2, RES );
|
|
+ if ( ARG4 != 0 )
|
|
+ POST_MEM_WRITE( ARG4, sizeof (vki_off_t));
|
|
+ }
|
|
+}
|
|
+
|
|
PRE(sys_seteuid)
|
|
{
|
|
PRINT("sys_seteuid ( %ld )", ARG1);
|
|
@@ -1251,6 +1283,19 @@ POST(sys_fstatfs6)
|
|
POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs6) );
|
|
}
|
|
|
|
+PRE(sys_fstatfs64)
|
|
+{
|
|
+ PRINT("sys_fstatfs64 ( %ld, %#lx )", ARG1, ARG2);
|
|
+ PRE_REG_READ2(long, "fstatfs6",
|
|
+ unsigned int, fd, struct statfs *, buf);
|
|
+ PRE_MEM_WRITE( "fstatfs6(buf)", ARG2, sizeof(struct vki_statfs64) );
|
|
+}
|
|
+
|
|
+POST(sys_fstatfs64)
|
|
+{
|
|
+ POST_MEM_WRITE( ARG2, sizeof(struct vki_statfs64) );
|
|
+}
|
|
+
|
|
PRE(sys_statfs6)
|
|
{
|
|
PRINT("sys_statfs6 ( %#lx(%s), %#lx )",ARG1,(char *)ARG1,ARG2);
|
|
@@ -3132,6 +3177,20 @@ POST(sys_fstatat)
|
|
POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
|
|
}
|
|
|
|
+PRE(sys_fstatat64)
|
|
+{
|
|
+ PRINT("sys_fstatat ( %ld, %#lx(%s), %#lx )", ARG1,ARG2,(char*)ARG2,ARG3);
|
|
+ PRE_REG_READ3(long, "fstatat",
|
|
+ int, dfd, char *, file_name, struct stat *, buf);
|
|
+ PRE_MEM_RASCIIZ( "fstatat(file_name)", ARG2 );
|
|
+ PRE_MEM_WRITE( "fstatat(buf)", ARG3, sizeof(struct vki_stat) );
|
|
+}
|
|
+
|
|
+POST(sys_fstatat64)
|
|
+{
|
|
+ POST_MEM_WRITE( ARG3, sizeof(struct vki_stat) );
|
|
+}
|
|
+
|
|
PRE(sys_unlinkat)
|
|
{
|
|
*flags |= SfMayBlock;
|
|
@@ -4427,6 +4486,12 @@ const SyscallTableEntry ML_(syscall_table)[] = {
|
|
BSDXY(__NR_accept4, sys_accept4), //541
|
|
BSDXY(__NR_pipe2, sys_pipe2), // 542
|
|
|
|
+ // ino64
|
|
+ BSDXY(__NR_fstat64, sys_fstat64), // 551
|
|
+ BSDXY(__NR_fstatat64, sys_fstatat64), // 552
|
|
+ BSDXY(__NR_getdirentries64, sys_getdirentries64), // 554
|
|
+ GENXY(__NR_fstatfs64, sys_fstatfs), // 556
|
|
+
|
|
BSDX_(__NR_fake_sigreturn, sys_fake_sigreturn), // 1000, fake sigreturn
|
|
|
|
};
|
|
diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h
|
|
index aee453e..f20833a 100644
|
|
--- a/include/vki/vki-freebsd.h
|
|
+++ b/include/vki/vki-freebsd.h
|
|
@@ -367,6 +367,38 @@ struct vki_stat {
|
|
unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
|
|
};
|
|
|
|
+struct vki_stat64 {
|
|
+ vki_uint64_t st_dev;
|
|
+ vki_uint64_t st_ino;
|
|
+ vki_uint64_t st_nlink;
|
|
+ vki_mode_t st_mode;
|
|
+ vki_int16_t st_padding0;
|
|
+ vki_uid_t st_uid;
|
|
+ vki_gid_t st_gid;
|
|
+ vki_int32_t st_padding1;
|
|
+ vki_uint64_t st_rdev;
|
|
+#if 0
|
|
+ struct vki_timespec st_atimespec;
|
|
+ struct vki_timespec st_mtimespec;
|
|
+ struct vki_timespec st_ctimespec;
|
|
+#else
|
|
+ vki_time_t st_atime;
|
|
+ long st_atime_nsec;
|
|
+ vki_time_t st_mtime;
|
|
+ long st_mtime_nsec;
|
|
+ vki_time_t st_ctime;
|
|
+ long st_ctime_nsec;
|
|
+#endif
|
|
+ vki_off_t st_size;
|
|
+ vki_blkcnt_t st_blocks;
|
|
+ vki_blksize_t st_blksize;
|
|
+ vki_fflags_t st_flags;
|
|
+ vki_uint64_t st_gen;
|
|
+ vki_int64_t st_spare[10];
|
|
+// struct vki_timespec st_birthtimespec;
|
|
+// unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
|
|
+// unsigned int :(8 / 2) * (16 - (int)sizeof(struct vki_timespec));
|
|
+};
|
|
|
|
//----------------------------------------------------------------------
|
|
// From linux-2.6.8.1/include/linux/sched.h
|
|
@@ -941,6 +973,30 @@ struct vki_statfs {
|
|
char f_mntonname[VKI_MNAMELEN];
|
|
};
|
|
|
|
+struct vki_statfs64 {
|
|
+ vki_uint32_t f_version;
|
|
+ vki_uint32_t f_type;
|
|
+ vki_uint64_t f_flags;
|
|
+ vki_uint64_t f_bsize;
|
|
+ vki_uint64_t f_iosize;
|
|
+ vki_uint64_t f_blocks;
|
|
+ vki_uint64_t f_bfree;
|
|
+ vki_int64_t f_bavail;
|
|
+ vki_uint64_t f_files;
|
|
+ vki_int64_t f_ffree;
|
|
+ vki_uint64_t f_syncwrites;
|
|
+ vki_uint64_t f_asyncwrites;
|
|
+ vki_uint64_t f_syncreads;
|
|
+ vki_uint64_t f_asyncreads;
|
|
+ vki_uint64_t f_spare[10];
|
|
+ vki_uint32_t f_namemax;
|
|
+ vki_uid_t f_owner;
|
|
+ vki_fsid_t f_fsid;
|
|
+ char f_charspare[80];
|
|
+ char f_fstypename[VKI_MFSNAMELEN];
|
|
+ char f_mntfromnname[VKI_MNAMELEN];
|
|
+ char f_mntonname[VKI_MNAMELEN];
|
|
+};
|
|
#define MAXFIDSZ 16
|
|
|
|
struct vki_fid {
|
|
diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h
|
|
index 605a42f..ffa241d 100644
|
|
--- a/include/vki/vki-scnums-freebsd.h
|
|
+++ b/include/vki/vki-scnums-freebsd.h
|
|
@@ -412,6 +412,10 @@
|
|
#define __NR_shmctl 512
|
|
#define __NR_accept4 541
|
|
#define __NR_pipe2 542
|
|
+#define __NR_fstat64 551
|
|
+#define __NR_fstatat64 552
|
|
+#define __NR_getdirentries64 554
|
|
+#define __NR_fstatfs64 556
|
|
|
|
#define __NR_fake_sigreturn 1000
|
|
|
|
--
|
|
2.14.1
|
|
|