|
From: <sv...@va...> - 2009-07-15 06:25:08
|
Author: njn
Date: 2009-07-15 07:24:57 +0100 (Wed, 15 Jul 2009)
New Revision: 10460
Log:
Added support for getfsstat64() on Darwin. This partly fixes bug 198624.
Fixed a couple of other minor things too.
Modified:
trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
trunk/coregrind/m_syswrap/syswrap-darwin.c
trunk/memcheck/tests/darwin/scalar.c
trunk/memcheck/tests/darwin/scalar.stderr.exp
Modified: trunk/coregrind/m_syswrap/priv_syswrap-darwin.h
===================================================================
--- trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-07-15 06:17:18 UTC (rev 10459)
+++ trunk/coregrind/m_syswrap/priv_syswrap-darwin.h 2009-07-15 06:24:57 UTC (rev 10460)
@@ -336,7 +336,7 @@
// NYI umask_extended 278
DECL_TEMPLATE(darwin, stat_extended); // 279
DECL_TEMPLATE(darwin, lstat_extended); // 280
-// NYI fstat_extended 281
+DECL_TEMPLATE(darwin, fstat_extended); // 281
DECL_TEMPLATE(darwin, chmod_extended); // 282
DECL_TEMPLATE(darwin, fchmod_extended); // 283
// NYI access_extended 284
@@ -398,11 +398,11 @@
DECL_TEMPLATE(darwin, lstat64); // 340
DECL_TEMPLATE(darwin, stat64_extended); // 341
DECL_TEMPLATE(darwin, lstat64_extended); // 342
-// NYI fstat64_extended 343
+DECL_TEMPLATE(darwin, fstat64_extended); // 343
DECL_TEMPLATE(darwin, getdirentries64); // 344
DECL_TEMPLATE(darwin, statfs64); // 345
DECL_TEMPLATE(darwin, fstatfs64); // 346
-// NYI getfsstat64 347
+DECL_TEMPLATE(darwin, getfsstat64); // 347
// NYI __pthread_chdir 348
// NYI __pthread_fchdir 349
// NYI audit 350
Modified: trunk/coregrind/m_syswrap/syswrap-darwin.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-07-15 06:17:18 UTC (rev 10459)
+++ trunk/coregrind/m_syswrap/syswrap-darwin.c 2009-07-15 06:24:57 UTC (rev 10460)
@@ -2085,10 +2085,9 @@
struct vki_statfs *, buf, int, bufsize, int, flags);
if (ARG1) {
// ARG2 is a BYTE SIZE
- PRE_MEM_WRITE("getfsstat", ARG1, ARG2);
+ PRE_MEM_WRITE("getfsstat(buf)", ARG1, ARG2);
}
}
-
POST(getfsstat)
{
if (ARG1) {
@@ -2097,7 +2096,25 @@
}
}
+PRE(getfsstat64)
+{
+ PRINT("getfsstat64(%#lx, %ld, %ld)", ARG1, ARG2, ARG3);
+ PRE_REG_READ3(int, "getfsstat64",
+ struct vki_statfs64 *, buf, int, bufsize, int, flags);
+ if (ARG1) {
+ // ARG2 is a BYTE SIZE
+ PRE_MEM_WRITE("getfsstat64(buf)", ARG1, ARG2);
+ }
+}
+POST(getfsstat64)
+{
+ if (ARG1) {
+ // RES is a STRUCT COUNT
+ POST_MEM_WRITE(ARG1, RES * sizeof(struct vki_statfs64));
+ }
+}
+
static void scan_attrlist(ThreadId tid, struct vki_attrlist *attrList,
void *attrBuf, SizeT attrBufSize,
void (*fn)(ThreadId, void *attrData, SizeT size)
@@ -3077,7 +3094,7 @@
vki_pid_t, pid, uint32_t, ops,
void *, useraddr, vki_size_t, usersize);
- PRE_MEM_WRITE( "csops(addr)", ARG3, ARG4 );
+ PRE_MEM_WRITE( "csops(useraddr)", ARG3, ARG4 );
// If the pid is ours, don't mark the program as KILL or HARD
// Maybe we should keep track of this for later calls to STATUS
@@ -3090,7 +3107,6 @@
}
}
}
-
POST(csops)
{
POST_MEM_WRITE( ARG3, ARG4 );
@@ -7425,7 +7441,7 @@
MACXY(__NR_getdirentries64, getdirentries64),
MACXY(__NR_statfs64, statfs64),
MACXY(__NR_fstatfs64, fstatfs64),
-// _____(__NR_getfsstat64),
+ MACXY(__NR_getfsstat64, getfsstat64),
// _____(__NR___pthread_chdir),
// _____(__NR___pthread_fchdir),
// _____(__NR_audit),
Modified: trunk/memcheck/tests/darwin/scalar.c
===================================================================
--- trunk/memcheck/tests/darwin/scalar.c 2009-07-15 06:17:18 UTC (rev 10459)
+++ trunk/memcheck/tests/darwin/scalar.c 2009-07-15 06:24:57 UTC (rev 10460)
@@ -75,7 +75,8 @@
GO_UNIMP(17, "old break");
- // __NR_getfsstat 18
+ GO(__NR_getfsstat, 18, "3s 1m");
+ SY(__NR_getfsstat, x0+1, x0+1, x0); SUCC; // This should fail...
GO_UNIMP(19, "old lseek");
@@ -616,7 +617,10 @@
// __NR_getdirentries64 344
// __NR_statfs64 345
// __NR_fstatfs64 346
- // __NR_getfsstat64 347
+
+ GO(__NR_getfsstat64, 347, "3s 1m");
+ SY(__NR_getfsstat64, x0+1, x0+1, x0); SUCC; // This should fail...
+
// __NR___pthread_chdir 348
// __NR___pthread_fchdir 349
// __NR_audit 350
Modified: trunk/memcheck/tests/darwin/scalar.stderr.exp
===================================================================
--- trunk/memcheck/tests/darwin/scalar.stderr.exp 2009-07-15 06:17:18 UTC (rev 10459)
+++ trunk/memcheck/tests/darwin/scalar.stderr.exp 2009-07-15 06:24:57 UTC (rev 10460)
@@ -184,6 +184,22 @@
(17): old break
-----------------------------------------------------
-----------------------------------------------------
+x2000012(18): __NR_getfsstat 3s 1m
+-----------------------------------------------------
+
+Syscall param getfsstat(buf) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat(bufsize) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat(flags) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat(buf) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
(19): old lseek
-----------------------------------------------------
-----------------------------------------------------
@@ -426,7 +442,7 @@
Syscall param csops(usersize) contains uninitialised byte(s)
...
-Syscall param csops(addr) points to unaddressable byte(s)
+Syscall param csops(useraddr) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
@@ -620,6 +636,9 @@
x2000117(279): __NR_stat_extended 4s 4m
-----------------------------------------------------
+More than 100 errors detected. Subsequent errors
+will still be recorded, but in less detail than before.
+
Syscall param stat_extended(file_name) contains uninitialised byte(s)
...
@@ -632,9 +651,6 @@
Syscall param stat_extended(fsacl_size) contains uninitialised byte(s)
...
-More than 100 errors detected. Subsequent errors
-will still be recorded, but in less detail than before.
-
Syscall param stat_extended(file_name) points to unaddressable byte(s)
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
@@ -870,6 +886,22 @@
...
Address 0x........ is not stack'd, malloc'd or (recently) free'd
-----------------------------------------------------
+x200015b(347): __NR_getfsstat64 3s 1m
+-----------------------------------------------------
+
+Syscall param getfsstat64(buf) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat64(bufsize) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat64(flags) contains uninitialised byte(s)
+ ...
+
+Syscall param getfsstat64(buf) points to unaddressable byte(s)
+ ...
+ Address 0x........ is not stack'd, malloc'd or (recently) free'd
+-----------------------------------------------------
(369-379): unused
-----------------------------------------------------
-----------------------------------------------------
|