diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-12-14 15:54:33 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-12-14 15:54:33 +0000 |
commit | e3d14af155fb84890a32fad7f7706967ac5bc7d9 (patch) | |
tree | 05df3064a2c24a1542e182a3aa2d5ff4e3df8f56 /winsup/cygwin/fhandler.cc | |
parent | 10cba930d401056aed4b2fb360b5e084d61ecabb (diff) | |
download | cygnal-e3d14af155fb84890a32fad7f7706967ac5bc7d9.tar.gz cygnal-e3d14af155fb84890a32fad7f7706967ac5bc7d9.tar.bz2 cygnal-e3d14af155fb84890a32fad7f7706967ac5bc7d9.zip |
* fhandler.cc (fhandler_base::open_9x): Handle O_SYNC and O_DIRECT
flags.
(fhandler_base::open): Ditto.
* fhandler_floppy.cc (fhandler_dev_floppy::open): Don't allocate devbuf
in O_DIRECT case.
* fhandler_raw.cc (fhandler_dev_raw::ioctl): Don't allow buffer
changes in O_DIRECT case. Allow returning a buffer size 0, which
indicates O_DIRECT.
* fhandler_tape.cc (fhandler_dev_tape::open): Use O_SYNC flag to
hand down the !buffer_writes case. Don't allocate devbuf in O_DIRECT
case.
(fhandler_dev_tape::raw_read): Don't mess with devbuf if it's NULL.
* include/fcntl.h: Define _FDIRECT, O_DIRECT, O_DSYNC and O_RSYNC.
* include/cygwin/version.h: Bump API minor version.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 6931cb6bc..0a119c845 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -492,6 +492,10 @@ fhandler_base::open_9x (int flags, mode_t mode) file_attributes = FILE_ATTRIBUTE_NORMAL; if (flags & O_DIROPEN) file_attributes |= FILE_FLAG_BACKUP_SEMANTICS; + if (flags & O_SYNC) + file_attributes |= FILE_FLAG_WRITE_THROUGH; + if (flags & O_DIRECT) + file_attributes |= FILE_FLAG_NO_BUFFERING; if (get_major () == DEV_SERIAL_MAJOR) file_attributes |= FILE_FLAG_OVERLAPPED; @@ -599,18 +603,16 @@ fhandler_base::open (int flags, mode_t mode) break; default: create_options = 0; - if (get_major () == DEV_TAPE_MAJOR && (flags & O_TEXT)) - { - /* O_TEXT is used to indicate write-through on tape devices */ - create_options |= FILE_WRITE_THROUGH; - flags &= ~O_TEXT; - } if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) access = GENERIC_READ; else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY) access = GENERIC_WRITE | FILE_READ_ATTRIBUTES; else access = GENERIC_READ | GENERIC_WRITE; + if (flags & O_SYNC) + create_options |= FILE_WRITE_THROUGH; + if (flags & O_DIRECT) + create_options |= FILE_NO_INTERMEDIATE_BUFFERING; if (get_major () != DEV_SERIAL_MAJOR && get_major () != DEV_TAPE_MAJOR) { create_options |= FILE_SYNCHRONOUS_IO_NONALERT; |