Re: [OT] 'volatile' in userspace

From: Björn Steinbrink
Date: Tue Jul 11 2006 - 15:08:19 EST


On 2006.07.11 21:53:53 +1000, Nick Piggin wrote:
> Jan Engelhardt wrote:
> >>What's wrong with _exit(exec() == -1 ? 0 : errno);
> >>and picking up the status with wait(2) ?
> >>
> >
> >The exec'd application may return regular error codes, which would
> >interfere. IIRC /usr/sbin/useradd has different exit codes depending on
> >what failed (providing some option, failure to create account, failure to
> >create home dir, etc.). Now if you exit(errno) instead, you have an
> >overlap.
>
> You're right. Maybe you could return -ve or with a high bit set,
> but I guess you may not know what the app will return.
>
> But I don't see how the volatile or pipe solutions are any better
> though: it would seem that both result in undefined behaviour
> according to my vfork man page. At least the wait() solution is
> defined (and workable, if you know what the target might return).

The volatile solution is buggy according to the vfork man page, but the
pipe solution is fine, it doesn't use vfork at all ;)

Björn
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/