mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-08 13:01:17 +00:00
- Fix __NR_poll printing
- Invert the sense of IOC_READ / IOC_WRITE in generic ioctl handler (Simon Hausmann) - TIOCSPGRP (Peter A Jonsson); also add a missing break in the ioctl stuff git-svn-id: svn://svn.valgrind.org/valgrind/trunk@302
This commit is contained in:
parent
09e37e6f37
commit
8aae7441fe
@ -1627,6 +1627,15 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
|
||||
KERNEL_DO_SYSCALL(tid,res);
|
||||
if (!VG_(is_kerror)(res) && res == 0)
|
||||
make_readable ( arg3, sizeof(pid_t) );
|
||||
break;
|
||||
case TIOCSPGRP:
|
||||
/* Set a process group ID? */
|
||||
must_be_writable( tst, "ioctl(TIOCGPGRP)", arg3,
|
||||
sizeof(pid_t) );
|
||||
KERNEL_DO_SYSCALL(tid,res);
|
||||
if (!VG_(is_kerror)(res) && res == 0)
|
||||
make_readable ( arg3, sizeof(pid_t) );
|
||||
break;
|
||||
case TIOCGPTN: /* Get Pty Number (of pty-mux device) */
|
||||
must_be_writable(tst, "ioctl(TIOCGPTN)", arg3, sizeof(int) );
|
||||
KERNEL_DO_SYSCALL(tid,res);
|
||||
@ -1974,11 +1983,14 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
|
||||
sizeof(struct cdrom_msf));
|
||||
KERNEL_DO_SYSCALL(tid,res);
|
||||
break;
|
||||
|
||||
/* We don't have any specific information on it, so
|
||||
try to do something reasonable based on direction and
|
||||
size bits. The encoding scheme is described in
|
||||
/usr/include/asm/ioctl.h. */
|
||||
/usr/include/asm/ioctl.h.
|
||||
|
||||
According to Simon Hausmann, _IOC_READ means the kernel
|
||||
writes a value to the ioctl value passed from the user
|
||||
space and the other way around with _IOC_WRITE. */
|
||||
default: {
|
||||
UInt dir = _IOC_DIR(arg2);
|
||||
UInt size = _IOC_SIZE(arg2);
|
||||
@ -1994,13 +2006,13 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
|
||||
" See README_MISSING_SYSCALL_OR_IOCTL for guidance on"
|
||||
" writing a proper wrapper." );
|
||||
} else {
|
||||
if ((dir & _IOC_READ) && size > 0)
|
||||
must_be_readable(tst, "ioctl(generic)", arg3, size);
|
||||
if ((dir & _IOC_WRITE) && size > 0)
|
||||
must_be_readable(tst, "ioctl(generic)", arg3, size);
|
||||
if ((dir & _IOC_READ) && size > 0)
|
||||
must_be_writable(tst, "ioctl(generic)", arg3, size);
|
||||
}
|
||||
KERNEL_DO_SYSCALL(tid,res);
|
||||
if (size > 0 && (dir & _IOC_WRITE)
|
||||
if (size > 0 && (dir & _IOC_READ)
|
||||
&& !VG_(is_kerror)(res) && res == 0)
|
||||
make_readable (arg3, size);
|
||||
break;
|
||||
@ -2254,7 +2266,7 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
|
||||
int timeout)
|
||||
*/
|
||||
if (VG_(clo_trace_syscalls))
|
||||
VG_(printf)("poll ( %d, %d, %d )\n",arg1,arg2,arg3);
|
||||
VG_(printf)("poll ( %p, %d, %d )\n",arg1,arg2,arg3);
|
||||
/* In fact some parts of this struct should be readable too.
|
||||
This should be fixed properly. */
|
||||
must_be_writable( tst, "poll(ufds)",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user