Mdoc Janitor:

* Add .Vt in the right places, transform some .Fa to .Vt, depending
    on discussion context.

  * When refering to the function malloc(), use .Fn, and not .Xr.

  * Add `The' to prefix a sentence when describing a function, so
    it results in ``The xxx() function..."

  * Use `system call' instead of `syscall'.

  * Improve the sentence which discusses accept_filt_generic_mod_event();
    Talk about moduledata_t, and refer to the DECLARE_MODULE(9) manual
    page.

  * Properly markup .An (Author Name) throughout the AUTHORS section.
This commit is contained in:
hmp 2003-10-23 05:01:30 +00:00
parent ff12dfc2e8
commit d5bc42e59f

View File

@ -60,7 +60,9 @@ of
.Dv SO_ACCEPTFILTER . .Dv SO_ACCEPTFILTER .
.Sh IMPLEMENTATION NOTES .Sh IMPLEMENTATION NOTES
A module that wants to be an accept filter A module that wants to be an accept filter
must provide a struct accept_filter to the system: must provide a
.Vt struct accept_filter
to the system:
.Bd -literal .Bd -literal
struct accept_filter { struct accept_filter {
char accf_name[16]; char accf_name[16];
@ -73,51 +75,58 @@ struct accept_filter {
.Pp .Pp
The module should register it with the function The module should register it with the function
.Fn accept_filt_add , .Fn accept_filt_add ,
passing a pointer to a struct accept_filter, allocated with passing a pointer to a
.Xr MALLOC 9 .Fa struct accept_filter ,
allocated with
.Fn malloc .
.Pp .Pp
The fields of The fields of
.Fa struct accept_filter .Vt struct accept_filter
are as follows: are as follows:
.Bl -tag -width accf_callbackXXX .Bl -tag -width accf_callbackXXX
.It accf_name .It Vt accf_name
Name of the filter; Name of the filter;
this is how it will be accessed from userland. this is how it will be accessed from userland.
.It accf_callback .It Fn accf_callback
The callback that the kernel will do The callback that the kernel will do
once the connection is established. once the connection is established.
It is the same as a socket upcall It is the same as a socket upcall
and will be called when the connection is established and will be called when the connection is established
and whenever new data arrives on the socket, and whenever new data arrives on the socket,
unless the callback modifies the socket's flags. unless the callback modifies the socket's flags.
.It accf_create .It Fn accf_create
Called whenever a Called whenever a
.Xr setsockopt 2 .Xr setsockopt 2
installs the filter onto installs the filter onto
a listening socket. a listening socket.
.It accf_destroy .It Fn accf_destroy
Called whenever the user removes the accept filter on the socket. Called whenever the user removes the accept filter on the socket.
.El .El
.Pp .Pp
The
.Fn accept_filt_del .Fn accept_filt_del
passed the same string used in accept_filter.accf_name during registration function
with passed the same string used in
.Va accept_filter.accf_name
during registration with
.Fn accept_filt_add , .Fn accept_filt_add ,
the kernel will then disallow and further userland use of the filter. the kernel will then disallow and further userland use of the filter.
.Pp .Pp
The
.Fn accept_filt_get .Fn accept_filt_get
is used internally to locate which accept filter to use via the function is used internally to locate which accept filter to use via the
.Fn setsockopt .Fn setsockopt
syscall. system call.
.Pp .Pp
The
.Fn accept_filt_generic_mod_event .Fn accept_filt_generic_mod_event
provides a simple way to avoid duplicate function provides a simple way to avoid duplication of code
code for accept filters which don't use for accept filters which don't use the argument field to load
argument field to load and unload and unload themselves.
themselves. It is a function that can be This function can be used in the
put in the load/unload struct .Vt moduledata_t
for the struct for the
.Fn DECLARE_MODULE .Xr DECLARE_MODULE 9
macro. macro.
.Sh SEE ALSO .Sh SEE ALSO
.Xr setsockopt 2 , .Xr setsockopt 2 ,
@ -129,7 +138,14 @@ The accept filter mechanism was introduced in
.Fx 4.0 . .Fx 4.0 .
.Sh AUTHORS .Sh AUTHORS
This manual page was written by This manual page was written by
.An -nosplit
.An Alfred Perlstein , .An Alfred Perlstein ,
Sheldon Hearn and Jeroen Ruigrok van der Werven. .An Sheldon Hearn
The accept filter concept was pioneered by David Filo at Yahoo! and
and refined to be a loadable module system by Alfred Perlstein. Jeroen Ruigrok van der Werven.
.Pp
The accept filter concept was pioneered by
.An David Filo
at Yahoo!
and refined to be a loadable module system by
.An Alfred Perlstein.