* 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.
This commit is contained in:
Corinna Vinschen
2000-10-23 20:16:52 +00:00
parent f80cdaeecb
commit 1eb14bae8c
5 changed files with 92 additions and 73 deletions

View File

@ -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