1 /* fcntl.cc: fcntl syscall
3 Copyright 1996, 1997, 1998 Cygnus Solutions.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
23 _fcntl (int fd, int cmd,...)
29 if (fdtab.not_open (fd))
36 SetResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK, "_fcntl");
38 arg = va_arg (args, void *);
40 res = dup2 (fd, fdtab.find_unused_handle ((int) arg));
42 res = fdtab[fd]->fcntl(cmd, arg);
44 ReleaseResourceLock(LOCK_FD_LIST,WRITE_LOCK|READ_LOCK,"_fcntl");
47 syscall_printf ("%d = fcntl (%d, %d, %p)", res, fd, cmd, arg);