1io_fd_flags(3)             Library Functions Manual             io_fd_flags(3)
2
3
4

NAME

6       io_fd_flags - prepare descriptor for io_wait
7

SYNTAX

9       #include <io.h>
10
11       int io_fd(int64 fd);
12
13       #ifdef HAVE_IO_FD_FLAGS
14
15       int io_fd_flags(int64 fd);
16

DESCRIPTION

18       io_fd_flags  behaves just like io_fd, but certain flags can be bitwise-
19       ORed to it to alter its behavior:
20
21
22       IO_FD_CANWRITE
23              tell io_fd that the descriptor is writable.  This is  useful  so
24              io_wantwrite  can  queue the descriptor immediately and there is
25              no need to query the operating system event reporting mechanism.
26
27       IO_FD_BLOCK
28              tell io_fd that the descriptor is blocking.
29
30       IO_FD_NONBLOCK
31              tell io_fd that the descriptor is non-blocking.
32
33       Normally, io_fd calls fcntl to ask the  operating  system  whether  the
34       descriptor is blocking or not.  The frameworks needs to know because it
35       alters how io_tryread and io_trywrite handle the  socket.   Never  pass
36       both IO_FD_BLOCK and IO_FD_NONBLOCK at the same time.
37
38       Newly connected stream sockets are always writable if the connection is
39       established, so it is usually safe to pass  IO_FD_CANWRITE.   The  main
40       exception  case  where IO_FD_CANWRITE should not be passed is on a non-
41       blocking socket where a connect() is pending.  Then you  need  to  poll
42       for writability to get notified when the connection is established.
43

RETURN VALUE

45       io_fd_flags returns 1 on success, 0 on error.
46

SEE ALSO

48       io_fd(3), io_fd_canwrite(3)
49
50
51
52                                                                io_fd_flags(3)
Impressum