Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-07-09 09:29:51 +0400
committerChristopher Faylor <me@cgf.cx>2000-07-09 09:29:51 +0400
commitbd4ec49671b07f93883c7e0c9142125525731714 (patch)
tree49c4d2e87d54048f97bea742896acb5b348ffda1 /winsup/cygwin/syscalls.cc
parent85219b356e249702b845cf667462584945b1735b (diff)
* cygwin.din: Export _getmode and getmode to allow querying of binary state of
an fd. * external.cc (cygwin_internal): Add handling of perfile_table setting. * fhandler.cc (perfile_table): New global. (fhandler_base::get_default_fmode): New method to return a file's default mode based on its name. (fhandler_base::open): Use get_default_mode method to determine a file's mode. Record file mode in file flags. * fhandler.h (fhandler_base): Declare get_default_fmode * syscalls.cc (getmode): New function. * sys/cygwin.h (__cygwin_perfile): New structure. (cygwin_getinfo_types): Move outside of WINVER conditional. (per_process): Move inside of WINVER conditional.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index b0251bffc..9594a4931 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1494,11 +1494,22 @@ setmode_helper (FILE *f)
return 0;
}
+extern "C" int
+getmode (int fd)
+{
+ if (dtable.not_open (fd))
+ {
+ set_errno (EBADF);
+ return -1;
+ }
+
+ return dtable[fd]->get_flags () & (O_BINARY | O_TEXT);
+}
+
/* Set a file descriptor into text or binary mode, returning the
previous mode. */
-extern "C"
-int
+extern "C" int
setmode (int fd, int mode)
{
if (dtable.not_open (fd))