2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
15 int fcntl(int fd
, int cmd
, ...)
17 fdesc
*desc
= __getfdesc(fd
);
33 arg
= va_arg(ap
, int);
37 FIXME: FD_CLOEXEC must be off on the copy, once this flag
38 is supported (related to F_GETFD and F_SETFD).
41 return dup2(fd
, __getfirstfd(arg
));
45 return desc
->flags
& (O_NONBLOCK
|O_APPEND
|O_ASYNC
);
51 int oldmode
= __oflags2amode(desc
->flags
& ~(O_NONBLOCK
|O_APPEND
|O_ASYNC
));
54 arg
= va_arg(ap
, int);
57 arg
&= (O_NONBLOCK
|O_APPEND
|O_ASYNC
);
59 if (ChangeMode(CHANGE_FH
, desc
->fh
, oldmode
| __oflags2amode(arg
)) == DOSTRUE
)
61 desc
->flags
&= ~(O_NONBLOCK
|O_APPEND
|O_ASYNC
);
66 errno
= IoErr2errno(IoErr());