michl@cernvax.UUCP (michl) (02/11/89)
Subject: open.c buglet, POSIX compatible open (2) (REPOST)
[This got lost the first and second time I tried to post it, seems as if
there's a black hole between here and cernvax, that's why I'm posting
from a friends account, mail to my address still works]
In the process of doing the code for non blocking IO for my named pipe
implementation (see previous article), I noticed a buglet in do_open;
it doesn't check the return codes of the block and character specific
open routines, resulting in the open always succeding even if something
goes wrong.
To fix this problem and reduce the amount of duplicate code, I've
merged the code of do_create (which doesn't have the above mentioned
bug) and do_open in to one routine, this makes the implementation of
the O_CREAT, O_EXCL, O_TRUNC flags trivial. One thing that I'm not
quite sure about, is where do store the flags in the filp struct,
while it would be more space efficient to store them in the filp_mode
field, this would mean that the conventional values for O_APPEND and
O_NONBLOCK can't be used (only a problem if there are programs that
don't use the defines in fcntl.h). Currently I think the best way is
to have a a field flip_flags that contains these values, this has the
added advantage (at the cost of 128 bytes) that fcntl (not done yet)
can return the conventional values for O_RDONLY etc..
Anybody got something to say to this?
[PS: in the mean time I just seen another error in read_write (line
9857 & 9858, the return code of pipe_check is ignored, it should
really be used in the return statement]
--
----------------------------------------------------------------------------
UUCP: ...mcvax!cernvax!forty2!poole Simon Poole
BITNET: K538915@CZHRZU1A
----------------------------------------------------------------------------michl@cernvax.UUCP (michl) (02/11/89)
In article <930@cernvax.UUCP> michl@cernvax.UUCP () writes: ... > >[PS: in the mean time I just seen another error in read_write (line > 9857 & 9858, the return code of pipe_check is ignored, it should > really be used in the return statement] STUPID, this bug only exists in the book, not in the current code (well at least I wasn't totally wrong :-() sorry. -- ---------------------------------------------------------------------------- UUCP: ...mcvax!cernvax!forty2!poole Simon Poole BITNET: K538915@CZHRZU1A ----------------------------------------------------------------------------