add iob_free and man page for iob_reset.
check in some windoze compat crap (still does not compile through for windoze)master
parent
e73c3e85f1
commit
9eb09b5bfe
@ -1,13 +1,22 @@
|
|||||||
#include <buffer.h>
|
#include <buffer.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void buffer_close(buffer* b) {
|
void buffer_close(buffer* b) {
|
||||||
if (b->fd != -1) close(b->fd);
|
if (b->fd != -1) close(b->fd);
|
||||||
switch (b->todo) {
|
switch (b->todo) {
|
||||||
case FREE: free(b->x); break;
|
case FREE: free(b->x); break;
|
||||||
case MUNMAP: munmap(b->x,b->a); break;
|
case MUNMAP:
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
UnmapViewOfFile(b->x);
|
||||||
|
#else
|
||||||
|
munmap(b->x,b->a); break;
|
||||||
|
#endif
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
.TH iob_free 3
|
||||||
|
.SH NAME
|
||||||
|
iob_free \- free an I/O batch
|
||||||
|
.SH SYNTAX
|
||||||
|
.B #include <iob.h>
|
||||||
|
|
||||||
|
void \fBiob_free\fP(io_batch* b);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
iob_free frees all resources associated with \fIb\fR. Calling iob_free
|
||||||
|
is equivalent to calling iob_reset and free.
|
||||||
|
avoiding unnecessary copying (using writev).
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
iob_new(3), iob_reset(3)
|
@ -0,0 +1,7 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include "iob_internal.h"
|
||||||
|
|
||||||
|
void iob_free(io_batch* b) {
|
||||||
|
iob_reset(b);
|
||||||
|
free(b);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
.TH iob_reset 3
|
||||||
|
.SH NAME
|
||||||
|
iob_reset \- reset an I/O batch
|
||||||
|
.SH SYNTAX
|
||||||
|
.B #include <iob.h>
|
||||||
|
|
||||||
|
void \fBiob_reset\fP(io_batch* b);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
iob_free empties the list of transactions in an I/O batch. Files added
|
||||||
|
with iob_addfile_close are closed, and buffer added with iob_addbuf_free
|
||||||
|
of iob_adds_free are freed.
|
||||||
|
|
||||||
|
The I/O batch itself is not freed. You can start adding transactions to
|
||||||
|
it again.
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
iob_new(3), iob_reset(3)
|
Loading…
Reference in New Issue