]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added support for getfsstat64() on Darwin. This partly fixes bug 198624.
authorNicholas Nethercote <njn@valgrind.org>
Wed, 15 Jul 2009 06:24:57 +0000 (06:24 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Wed, 15 Jul 2009 06:24:57 +0000 (06:24 +0000)
Fixed a couple of other minor things too.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10460

coregrind/m_syswrap/priv_syswrap-darwin.h
coregrind/m_syswrap/syswrap-darwin.c
memcheck/tests/darwin/scalar.c
memcheck/tests/darwin/scalar.stderr.exp

index 0803a43ca06eaba60e417fc9d522decf54b4f2bb..b4c5fbf5508fa80af3f87477356d0183e38cd089 100644 (file)
@@ -336,7 +336,7 @@ DECL_TEMPLATE(darwin, sem_destroy);             // 276
 // 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, fstat64);                 // 339
 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
index 4f487f2e2780128b217a5086fd220b636399ca34..4a37f4d1b88099295c27b6b4d95950c9bf5e6b20 100644 (file)
@@ -2085,10 +2085,9 @@ PRE(getfsstat)
                  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,6 +2096,24 @@ POST(getfsstat)
    }
 }
 
+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, 
@@ -3077,7 +3094,7 @@ PRE(csops)
                  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 @@ PRE(csops)
       }
    }
 }
-
 POST(csops)
 {
    POST_MEM_WRITE( ARG3, ARG4 );
@@ -7425,7 +7441,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    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), 
index ac3dff85316e6ae479977d186d85f8ca80e70f19..55ec84e815a2786732363047beb9c95850fbc991 100644 (file)
@@ -75,7 +75,8 @@ int main(void)
 
    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 @@ int main(void)
    // __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
index 9976f8594fdf55e40cf9e805043edf5b53e0d8d6..97309996052f08487661183c204cc81257ca97de 100644 (file)
@@ -184,6 +184,22 @@ Syscall param chown(path) points to unaddressable byte(s)
 (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(useraddr) contains uninitialised byte(s)
 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 @@ Syscall param sem_destroy(sem) points to unaddressable byte(s)
 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) contains uninitialised byte(s)
 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 @@ Syscall param fstat64_extended(fsacl) points to unaddressable byte(s)
    ...
  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
 -----------------------------------------------------
 -----------------------------------------------------