GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
io_fd_flags(3) FreeBSD Library Functions Manual io_fd_flags(3)

io_fd_flags - prepare descriptor for io_wait

#include <libowfat/io.h>

int io_fd(int64 fd);

#ifdef HAVE_IO_FD_FLAGS

int io_fd_flags(int64 fd);

io_fd_flags behaves just like io_fd, but certain flags can be bitwise-ORed to it to alter its behavior:

IO_FD_CANWRITE
tell io_fd that the descriptor is writable. This is useful so io_wantwrite can queue the descriptor immediately and there is no need to query the operating system event reporting mechanism.
IO_FD_BLOCK
tell io_fd that the descriptor is blocking.
IO_FD_NONBLOCK
tell io_fd that the descriptor is non-blocking.

Normally, io_fd calls fcntl to ask the operating system whether the descriptor is blocking or not. The frameworks needs to know because it alters how io_tryread and io_trywrite handle the socket. Never pass both IO_FD_BLOCK and IO_FD_NONBLOCK at the same time.

Newly connected stream sockets are always writable if the connection is established, so it is usually safe to pass IO_FD_CANWRITE. The main exception case where IO_FD_CANWRITE should not be passed is on a non-blocking socket where a connect() is pending. Then you need to poll for writability to get notified when the connection is established.

io_fd_flags returns 1 on success, 0 on error.

io_fd(3), io_fd_canwrite(3)

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.