Add support for the FIGETBSZ and FIBMAP ioctls based on a patch
from Joseph D Wagner <theman@josephdwagner.info>.
CCMAIL: 83025-done@bugs.kde.org
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2426 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c
index d6037bf..d9d07be 100644
--- a/coregrind/vg_syscalls.c
+++ b/coregrind/vg_syscalls.c
@@ -1734,12 +1734,12 @@
/* int fstatfs(int fd, struct statfs *buf); */
MAYBE_PRINTF("fstatfs ( %d, %p )\n",arg1,arg2);
SYSCALL_TRACK( pre_mem_write, tid, "stat(buf)",
- arg2, sizeof(struct statfs) );
+ arg2, sizeof(struct vki_statfs) );
}
POST(fstatfs)
{
- VG_TRACK( post_mem_write, arg2, sizeof(struct statfs) );
+ VG_TRACK( post_mem_write, arg2, sizeof(struct vki_statfs) );
}
PRE(getsid)
@@ -3380,7 +3380,16 @@
case CDROM_DRIVE_STATUS: /* 0x5326 */
case CDROM_CLEAR_OPTIONS: /* 0x5321 */
break;
-
+
+ case FIGETBSZ:
+ SYSCALL_TRACK( pre_mem_write,tid, "ioctl(FIGETBSZ)", arg3,
+ sizeof(unsigned long));
+ break;
+ case FIBMAP:
+ SYSCALL_TRACK( pre_mem_read,tid, "ioctl(FIBMAP)", arg3,
+ sizeof(unsigned long));
+ break;
+
#ifdef HAVE_LINUX_FB_H
case FBIOGET_VSCREENINFO: /* 0x4600 */
SYSCALL_TRACK( pre_mem_write,tid,
@@ -3813,6 +3822,15 @@
case CDROM_CLEAR_OPTIONS: /* 0x5321 */
break;
+ case FIGETBSZ:
+ if (res == 0)
+ VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
+ break;
+ case FIBMAP:
+ if (res == 0)
+ VG_TRACK( post_mem_write,arg3, sizeof(unsigned long));
+ break;
+
#ifdef HAVE_LINUX_FB_H
case FBIOGET_VSCREENINFO: //0x4600
if (res == 0)
@@ -4914,12 +4932,12 @@
MAYBE_PRINTF("statfs ( %p, %p )\n",arg1,arg2);
SYSCALL_TRACK( pre_mem_read_asciiz, tid, "statfs(path)", arg1 );
SYSCALL_TRACK( pre_mem_write, tid, "statfs(buf)",
- arg2, sizeof(struct statfs) );
+ arg2, sizeof(struct vki_statfs) );
}
POST(statfs)
{
- VG_TRACK( post_mem_write, arg2, sizeof(struct statfs) );
+ VG_TRACK( post_mem_write, arg2, sizeof(struct vki_statfs) );
}
PRE(statfs64)
@@ -4928,12 +4946,12 @@
MAYBE_PRINTF("statfs64 ( %p, %p )\n",arg1,arg2);
SYSCALL_TRACK( pre_mem_read_asciiz, tid, "statfs64(path)", arg1 );
SYSCALL_TRACK( pre_mem_write, tid, "statfs64(buf)",
- arg2, sizeof(struct statfs64) );
+ arg2, sizeof(struct vki_statfs64) );
}
POST(statfs64)
{
- VG_TRACK( post_mem_write, arg2, sizeof(struct statfs64) );
+ VG_TRACK( post_mem_write, arg2, sizeof(struct vki_statfs64) );
}
PRE(symlink)
diff --git a/coregrind/vg_unsafe.h b/coregrind/vg_unsafe.h
index 6bcc8ab..f3ce02b 100644
--- a/coregrind/vg_unsafe.h
+++ b/coregrind/vg_unsafe.h
@@ -64,6 +64,7 @@
#include <signal.h> /* for siginfo_t */
#include <linux/timex.h> /* for adjtimex */
#include <linux/hdreg.h> /* for hard drive ioctls */
+#include <linux/fs.h> /* for filing system ioctls */
#ifdef HAVE_LINUX_FB_H
#include <linux/fb.h> /* for fb_* structs */
#endif
diff --git a/include/vg_kerneliface.h b/include/vg_kerneliface.h
index 186355c..7ba9b3d 100644
--- a/include/vg_kerneliface.h
+++ b/include/vg_kerneliface.h
@@ -726,7 +726,7 @@
* bits/statfs.h
*/
-struct statfs {
+struct vki_statfs {
unsigned int f_type;
unsigned int f_bsize;
unsigned int f_blocks;
@@ -740,7 +740,7 @@
unsigned int f_spare[5];
};
-struct statfs64 {
+struct vki_statfs64 {
unsigned int f_type;
unsigned int f_bsize;
unsigned long long f_blocks;