diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-10-23 20:16:52 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-10-23 20:16:52 +0000 |
commit | 1eb14bae8cc488dad2da4925cb73e4376c69fe45 (patch) | |
tree | 105a09afcbb92f6c87105b135f26397cc7866f3e /winsup/cygwin/fhandler.cc | |
parent | f80cdaeecbe2f65d2b6026bd25923cca7c9ab455 (diff) | |
download | cygnal-1eb14bae8cc488dad2da4925cb73e4376c69fe45.tar.gz cygnal-1eb14bae8cc488dad2da4925cb73e4376c69fe45.tar.bz2 cygnal-1eb14bae8cc488dad2da4925cb73e4376c69fe45.zip |
* 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.cc | 44 |
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 |