diff options
author | Christopher Faylor <me@cgf.cx> | 2000-03-12 06:29:54 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-03-12 06:29:54 +0000 |
commit | 3f0b4935404f01ab19ecab559a3201d4bb1ec5ca (patch) | |
tree | cc60ec7a05e57f8a4049bff0959bdd3ae24ae04c /winsup/cygwin/fhandler.cc | |
parent | 774ea162116fcb08278c5efbe287848f5b5dd431 (diff) | |
download | cygnal-3f0b4935404f01ab19ecab559a3201d4bb1ec5ca.tar.gz cygnal-3f0b4935404f01ab19ecab559a3201d4bb1ec5ca.tar.bz2 cygnal-3f0b4935404f01ab19ecab559a3201d4bb1ec5ca.zip |
* fhandler.cc (fhandler_base::get_readahead_into_buffer): New function.
* fhandler.h: Declare new function. Add extra argument to
process_slave_output.
* fhandler_console.cc (fhandler_console::read): Move read ahead code to new
function.
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Move common code
here.
(fhandler_tty_slave::read): Understand readahead.
(fhandler_pty_master::read): Move code to process_slave_output.
* select.cc (peek_pipe): Avoid performing certain checks when non-read and on
inappropriate fh types.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index c9a493fc0..4fbe8d33a 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -96,6 +96,24 @@ fhandler_base::eat_readahead (int n) return oralen; } +int +fhandler_base::get_readahead_into_buffer (char *buf, size_t buflen) +{ + int ch; + int copied_chars = 0; + + while (buflen) + if ((ch = get_readahead ()) < 0) + break; + else + { + buf[copied_chars++] = (unsigned char)(ch & 0xff); + buflen--; + } + + return copied_chars; +} + uid_t __stdcall get_file_owner (int use_ntsec, const char *filename) { |