Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
iob_init(3)		   Library Functions Manual		   iob_init(3)

NAME
       iob_init_autofree - initialize new I/O batch with autofree flag set

SYNTAX
       #include	<libowfat/iob.h>

       int iob_init_autofree(io_batch* b,size_t	hint_entries);

DESCRIPTION
       iob_init_autofree  initializes  *b  with	 enough	 space	allocated  for
       hint_entries entries (buffers or	files).	This is	purely	a  performance
       hint, if	you are	unsure just pass 1.

       The  autofree  flag will	be set,	which means resources will be freed in
       iob_send	once they have been sent out, not only once you	call iob_reset
       or iob_free at the end. You still have to call those as	autofree  only
       frees resources to be sent in the batch,	not the	resources of the batch
       itself.

       You can add buffers, strings and	files to an I/O	batch and then send it
       all at once using iob_send.

       The  benefit of the I/O batch API is that it exploits platform specific
       APIs like FreeBSD's sendfile.  The file contents	will always be sent in
       a way that allows the operating systems to perform zero copy  TCP,  and
       the  buffers  will always be sent using as few syscalls as possible and
       avoiding	unnecessary copying (using writev).

RETURN VALUE
       iob_init	returns	0 on success. If there was a memory allocation	error,
       it returns -1 instead.

SEE ALSO
       iob_new(3),  iob_init_autofree(3),  iob_reset(3),  iob_send(3), iob_ad-
       dbuf(3),	iob_adds_free(3), iob_addfile(3)

								   iob_init(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=libowfat_iob_init_autofree&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help