|
From: Jeremy F. <je...@go...> - 2003-10-30 10:25:37
|
On Thu, 2003-10-30 at 02:01, Josef Weidendorfer wrote:
> I just checked my skin with Valgrind CVS and Suse 9.0,
> and now I have the problem that the skin doesn't generate
> dumps any more.
Sorry, I changed the return code for VG_(open)() so it returns -ve error
code (errno) rather than simply -1. You can either use "if (fd < 0)" or
maybe something like "if (fd == -VKI_EEXIST) { ... } else { ... }".
> getpid() = 13270
> open("/home/weidendo/dumps/cachegrind.out.13270", O_WRONLY|O_TRUNC) = -1 ENOENT (No such file or directory)
> close(-2) = -1 EBADF (Bad file descriptor)
>
> Obviously, strace correctly gives back -1 for
> fd = VG_(open)(filename, VKI_O_WRONLY|VKI_O_TRUNC, 0);
> but my skin gets -2 (Ok, that's a small bug to call close(-2), but still...).
> But it should get -1, too ?!?
No. strace is (somewhat) lying - the syscall is returning -2, not -1.
If you were using libc, then open() would return -1 and set errno to 2
(ENOENT). But since we're going straight to the kernel and don't have
errno, VG_(open) is directly returning the negative error code (-2 ==
ENOENT).
J
|