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:
authorCorinna Vinschen <corinna@vinschen.de>2000-10-24 00:16:52 +0400
committerCorinna Vinschen <corinna@vinschen.de>2000-10-24 00:16:52 +0400
commit1eb14bae8cc488dad2da4925cb73e4376c69fe45 (patch)
tree105a09afcbb92f6c87105b135f26397cc7866f3e /winsup/cygwin/fhandler.cc
parentf80cdaeecbe2f65d2b6026bd25923cca7c9ab455 (diff)
* fcntl.cc (_fcntl): Rearrange as wrapper function. Move all
functionality except F_DUPFD to fhandler classes. * fhandler.cc (fhandler_base::fcntl): New method. * net.cc (fhandler_socket::fcntl): Ditto. * fhandler.h (class fhandler_base): Add method prototype for fcntl(). (class fhandler_socket): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 5d2be0f31..8e6c33161 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -997,6 +997,50 @@ fhandler_base::dup (fhandler_base *child)
return 0;
}
+int fhandler_base::fcntl (int cmd, void *arg)
+{
+ int res;
+
+ /*int temp = 0;*/
+
+ switch (cmd)
+ {
+ case F_GETFD:
+ res = get_close_on_exec () ? FD_CLOEXEC : 0;
+ break;
+ case F_SETFD:
+ set_close_on_exec ((int) arg);
+ res = 0;
+ break;
+ case F_GETFL:
+ res = get_flags ();
+ break;
+ case F_SETFL:
+ /* Only O_APPEND, O_NONBLOCK and O_ASYNC may be set. */
+ /*
+ if (arg & O_RDONLY)
+ temp |= GENERIC_READ;
+ if (arg & O_WRONLY)
+ temp |= GENERIC_WRITE;
+ syscall_printf ("fcntl (F_SETFL, %d)", (int) arg);
+ set_access (temp);
+ */
+ set_flags ((int) arg);
+ res = 0;
+ break;
+ case F_GETLK:
+ case F_SETLK:
+ case F_SETLKW:
+ res = lock (cmd, (struct flock *) arg);
+ break;
+ default:
+ set_errno (EINVAL);
+ res = -1;
+ break;
+ }
+ return res;
+}
+
/* Base terminal handlers. These just return errors. */
int