Re: Linux 2.1.125 doesn't dump core on SIGSEGV

Ken Pizzini (ken@halcyon.com)
Sun, 15 Nov 1998 21:30:16 -0800


On linux-kernel, message <19981116084719.A16448@caffeine.ix.net.nz>,
chris@cybernet.co.nz wrote:
>On Fri, Nov 13, 1998 at 09:23:48AM -0800, Ken Pizzini wrote:
>
>> Why not? The O_NOFOLLOW is distinguishable, so NOFOLLOW semantics
>> would be enabled, and RDWR is distinguishable, so RDWR mode would
>> be enabled.
>
>Because it implies O_CREAT - so if the file doesn't exist, we will
>creat it. Therefore this can't be reliaed upon to fail whena file
>isn't there, something that will break apps.

No it doesn't. Read my proposal again:

> (bit patterns made up for example purposes):
> #define O_CREAT 0x50 0101
> #define O_EXCL 0xa0 1010
> #define O_NOFOLLOW 0xc0 1100
>
> Then we get (O_CREAT|O_EXCL) == (O_CREAT|O_EXCL|O_NOFOLLOW),
> but we can detect that none of O_CREAT, O_EXCL, ((O_CREAT|O_EXCL)&~O_NOFOLLOW)
> match (x&O_NOFOLLOW)==O_NOFOLLOW.

This choice of bits allows one to distinguish the seven cases of:
O_CREAT only (0x50)
O_EXCL only (0xa0)
O_NOFOLLOW only (0xc0)
O_CREAT|O_NOFOLLOW, but without O_EXCL (0xd0)
O_EXCL|O_NOFOLLOW, but without O_CREAT (0xe0)
O_EXCL|O_CREAT, with or without O_NOFOLLOW (0xf0)
None of O_EXCL, O_CREAT, O_NOFOLLOW (0x00)

Now I am certainly not wed to the specific choice of bits; they were
purely chosen to illustrate the idea. In particular, I didn't bother
to check what bits were actually used in <asm/fcntl.h>; a more
realistic set of values might be:
O_CREAT 0004100
O_EXCL 0100200
O_NONBLOCK 0104000
In any event, the concept is the same.

--Ken Pizzini

-
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/