Re: ptrace errors are misleading

From: Mike Coleman (mcoleman2@kc.rr.com)
Date: Tue May 23 2000 - 14:22:12 EST


Victor Zandy <zandy@cs.wisc.edu> writes:
> On x86 Linux 2.2 and 2.3 ptrace sets errno to ESRCH ("no such
> process") when the process is not being traced or when it is not
> stopped (arch/i386/kernel/ptrace.c).
>
> Shouldn't it return EPERM instead?

As far as I can see, it could have been done that way, and perhaps it should
have, but it is documented.

Would the change be to match some spec or the behavior of another Unix, or
just because ESRCH seems misleading?

The current error scheme has a certain logic: You get EPERM when you don't
have the right permissions, whereas you get ESRCH when you're trying to do
something that's nonsense or impossible. (The exception is that you get EPERM
if you try to trace an already traced process.)

--Mike

-- 
Any sufficiently adverse technology is indistinguishable from Microsoft.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:24 EST