* fhandler.h (class fhandler_base): Add was_nonblocking status flag.

* fhandler.cc (fhandler_base::set_flags): Set was_nonblocking if the
	O_NONBLOCK flag has been specified.
	(fhandler_base_overlapped::close): Check for was_nonblocking instead
	of for is_nonblocking.  Explain why.
	(fhandler_base::set_nonblocking): Set was_nonblocking if noblocking
	mode gets enabled.
This commit is contained in:
Corinna Vinschen
2015-02-24 11:05:02 +00:00
parent f8a6c96306
commit 59076540bc
4 changed files with 33 additions and 4 deletions

View File

@ -149,12 +149,16 @@ class fhandler_base
unsigned need_fork_fixup : 1; /* Set if need to fixup after fork. */
unsigned isclosed : 1; /* Set when fhandler is closed. */
unsigned mandatory_locking : 1; /* Windows mandatory locking */
unsigned was_nonblocking : 1; /* Set when setting O_NONBLOCK. Never
reset. This is for the sake of
fhandler_base_overlapped::close. */
public:
status_flags () :
rbinary (0), rbinset (0), wbinary (0), wbinset (0), nohandle (0),
did_lseek (0), query_open (no_query), close_on_exec (0),
need_fork_fixup (0), isclosed (0), mandatory_locking (0)
need_fork_fixup (0), isclosed (0), mandatory_locking (0),
was_nonblocking (0)
{}
} status, open_status;
@ -250,6 +254,7 @@ class fhandler_base
IMPLEMENT_STATUS_FLAG (bool, need_fork_fixup)
IMPLEMENT_STATUS_FLAG (bool, isclosed)
IMPLEMENT_STATUS_FLAG (bool, mandatory_locking)
IMPLEMENT_STATUS_FLAG (bool, was_nonblocking)
int get_default_fmode (int flags);