From owner-freebsd-hackers Sat Oct 11 15:56:53 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA16183 for hackers-outgoing; Sat, 11 Oct 1997 15:56:53 -0700 (PDT) (envelope-from owner-freebsd-hackers) Received: from proxy3.ba.best.com (root@proxy3.ba.best.com [206.184.139.14]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA16178 for ; Sat, 11 Oct 1997 15:56:49 -0700 (PDT) (envelope-from mdean@shellx.best.com) Received: from shellx.best.com (shellx.best.com [206.86.0.11]) by proxy3.ba.best.com (8.8.7/8.8.BEST) with ESMTP id PAA14442; Sat, 11 Oct 1997 15:54:48 -0700 (PDT) Received: from localhost (mdean@localhost) by shellx.best.com (8.8.6/8.8.3) with SMTP id PAA01289; Sat, 11 Oct 1997 15:54:47 -0700 (PDT) Date: Sat, 11 Oct 1997 15:54:46 -0700 (PDT) From: mdean To: Terry Lambert cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Is this a bug, or just a feature. In-Reply-To: <199710112201.PAA05910@usr06.primenet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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. >