Check out my first novel, midnight's simulacra!
FreeBSD APIs: Difference between revisions
From dankwiki
m (1 revision) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
I'm documenting [[FreeBSD|FreeBSD's]] departures from known standards/APIUE/UNP as I come across them in various man pages and source code. | I'm documenting [[FreeBSD|FreeBSD's]] departures from known standards/APIUE/UNP as I come across them in various man pages and source code. The entirety of the FreeBSD man pages can be browsed at http://www.freebsd.org/cgi/man.cgi. This page serves as a companion to "[[Linux APIs]]" and "[[POSIX]]". | ||
==File descriptors== | ==File descriptors== | ||
* <tt>[[kqueue|kqueue(2)]]</tt>, introduced in FreeBSD 4.1, is FreeBSD's "better <tt>poll(2)</tt>", ala <tt>[[epoll|epoll(7)]]</tt> on [[Linux APIs|Linux]]. | * <tt>[[kqueue|kqueue(2)]]</tt>, introduced in FreeBSD 4.1, is FreeBSD's "better <tt>poll(2)</tt>", ala <tt>[[epoll|epoll(7)]]</tt> on [[Linux APIs|Linux]]. | ||
* <tt>[https://man.freebsd.org/cgi/man.cgi?query=accept_filter accept_filter(9)]</tt> | |||
* <tt>getfh()</tt> and <tt>openfh()</tt>, similar to Linux's <tt>name_to_handle_at()</tt> and <tt>open_by_handle_at()</tt> | |||
== Socket Options == | == Socket Options == | ||
Line 10: | Line 12: | ||
* TCP_NOPUSH: Normally, every write operation to a TCP socket will result in an attempt to set the [[TCP]] PSH bit and transmit the queued data. With TCP_NOPUSH set, packets will be coalesced until either the MSS is reached, or the socket is closed. Compare to [[Linux APIs#IPPROTO_TCP|Linux's]] TCP_CORK. | * TCP_NOPUSH: Normally, every write operation to a TCP socket will result in an attempt to set the [[TCP]] PSH bit and transmit the queued data. With TCP_NOPUSH set, packets will be coalesced until either the MSS is reached, or the socket is closed. Compare to [[Linux APIs#IPPROTO_TCP|Linux's]] TCP_CORK. | ||
** It is my experience that clearing this flag will result in the transmission of queued data, but I cannot find documentation supporting this. Tony Finch's [http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_usrreq.c.diff?r1=1.52&r2=1.53 kernel patch] seems to have been applied to FreeBSD 4.5, providing this behavior. | ** It is my experience that clearing this flag will result in the transmission of queued data, but I cannot find documentation supporting this. Tony Finch's [http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_usrreq.c.diff?r1=1.52&r2=1.53 kernel patch] seems to have been applied to FreeBSD 4.5, providing this behavior. | ||
[[CATEGORY:FreeBSD]] |
Latest revision as of 09:03, 11 March 2024
I'm documenting FreeBSD's departures from known standards/APIUE/UNP as I come across them in various man pages and source code. The entirety of the FreeBSD man pages can be browsed at http://www.freebsd.org/cgi/man.cgi. This page serves as a companion to "Linux APIs" and "POSIX".
File descriptors
- kqueue(2), introduced in FreeBSD 4.1, is FreeBSD's "better poll(2)", ala epoll(7) on Linux.
- accept_filter(9)
- getfh() and openfh(), similar to Linux's name_to_handle_at() and open_by_handle_at()
Socket Options
SOL_SOCKET
- SO_ACCEPTFILTER (Introduced in FreeBSD 4.0): Apply an accept_filter(9) kernel module to the listen(2)ing socket. The connection will not be accept(2)able until the filter is satisfied. accf_data(9), satisfied by the receipt of any connection payload data, is roughly equivalent to Linux's TCP_DEFER_ACCEPT.
IPPROTO_TCP
- TCP_NOPUSH: Normally, every write operation to a TCP socket will result in an attempt to set the TCP PSH bit and transmit the queued data. With TCP_NOPUSH set, packets will be coalesced until either the MSS is reached, or the socket is closed. Compare to Linux's TCP_CORK.
- It is my experience that clearing this flag will result in the transmission of queued data, but I cannot find documentation supporting this. Tony Finch's kernel patch seems to have been applied to FreeBSD 4.5, providing this behavior.