summaryrefslogtreecommitdiff
path: root/devel/valgrind/files/extra-patch-ino64
blob: e7b3dd669b39888ad354c9794098f024e8fec2d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
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