Re: O_NONBLOCK is broken

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Denys Vlasenko
Date: Sunday, August 19, 2007 - 5:50 am

On Tuesday 14 August 2007 22:59, David Schwartz wrote:

It means that the design is flawed and if done right, file flags
which are changeable by fcntl (O_NONBLOCK, O_APPEND, O_ASYNC, O_DIRECT, 
O_NOATIME) shouldn't be shared, they are useless as shared.
IOW, they should be file _descriptor_ flags.

It's unlikely that kernel tribe leaders will agree to violate POSIX
and make fcntl(F_SETFL) be per-fd thing. There can be users of this
(mis)feature.

Making fcntl(F_SETFD) accept those same flags and making it override
F_SETFL flags may fare slightly better, but may require propagation
of these flags into *a lot* of kernel codepaths.


I am submitting a patch witch allows this. Let's see what people will say.

Yet another way to fix this problem is to add a new fcntl operation
"duplicate an open file":

fd = fcntl(fd, F_DUPFL, min_fd);

which is analogous to F_DUPFD, but produces _unshared_ file descriptor.
You can F_SETFL it as you want, no one else will be affected.


Yep, maybe. But this is a different problem.
IOW: there are cases where one doesn't want this kind of locking,
but simply needs to do unblocked read/write. That's what I'm trying
to solve.
--
vda
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
O_NONBLOCK is broken, Denys Vlasenko, (Tue Aug 14, 4:41 am)
Re: O_NONBLOCK is broken, Alan Cox, (Tue Aug 14, 5:33 am)
Re: O_NONBLOCK is broken, Jan Engelhardt, (Tue Aug 14, 10:28 am)
RE: O_NONBLOCK is broken, David Schwartz, (Tue Aug 14, 2:59 pm)
Re: O_NONBLOCK is broken, Denys Vlasenko, (Sun Aug 19, 5:50 am)