Date: Sat, 11 Oct 1997 15:54:46 -0700 (PDT) From: mdean <mdean@best.com> To: Terry Lambert <tlambert@primenet.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Is this a bug, or just a feature. Message-ID: <Pine.SGI.3.95.971011154726.27647A-100000@shellx.best.com> In-Reply-To: <199710112201.PAA05910@usr06.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Sorry, I was confused I meant
open ("/dev/fd0", O_RDWR|O_WRONLY, 0);
which gives a valid descriptor when executed(and a disk is in the drive)
O_RDWR+O_WRONLY = O_ACCMODE which I am at least using to mask the oflags
and running the remaining bits through a switch statement checking for
O_RDONLY , O_RDWR, O_WRONLY (for this particular device these actually
matter, I am using them to determine the direction of the port for some
control regs) so at the end of the switch i have a default: return (EPERM);
since having O_RDONLY and O_RDWR set at the same time is meaningless (they
are mutually exclusive for me). I was just suprised this isn't caught
before it gets passed to the driver.
On Sat, 11 Oct 1997, Terry Lambert wrote:
> > Shouldn't it be an error to call open("/dev/fd0", RD_ONLY|WR_ONLY,0)?
> > I guess if your device doesn't like being read-only and write-only then it
> > should look at oflags for itself? Or should this be caught at the syscall
> > and rejected?
>
> Do you mean O_RDONLY|O_WRONLY?
>
> These are not bit values:
>
> #define O_RDONLY 0x0000 /* open for reading only */
> #define O_WRONLY 0x0001 /* open for writing only */
> #define O_RDWR 0x0002 /* open for reading and writing */
>
> (O_RDONLY|O_WRONLY) == O_WRONLY
>
>
> Terry Lambert
> terry@lambert.org
> ---
> Any opinions in this posting are my own and not those of my present
> or previous employers.
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.3.95.971011154726.27647A-100000>
