From: Nicholas N. <nj...@ca...> - 2003-10-30 10:35:36
|
On Thu, 30 Oct 2003, Jeremy Fitzhardinge wrote: > 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). The different views of syscalls -- glibc's view vs. the kernel's view -- has tripped me up before. Generally, the kernel returns a negative error value, and then glibc puts that in errno (but positive), and returns -1 from the call. There are some cases where the kernel vs. glibc difference is bigger -- I think mmap, brk and getcwd are examples. N |