evio
6.0
|
These routines handle opening & closing the ev lib for reading or writing to a file, buffer, or socket. More...
Functions | |
int | evOpen (char *filename, char *flags, int *handle) |
This function opens a file for either reading or writing evio format data. More... | |
int | evOpenBuffer (char *buffer, uint32_t bufLen, char *flags, int *handle) |
This function allows for either reading or writing evio format data from a buffer. More... | |
int | evOpenSocket (int sockFd, char *flags, int *handle) |
This function allows for either reading or writing evio format data from a TCP socket. More... | |
int | evClose (int handle) |
This routine flushes any existing evio format data in an internal buffer (written to with evWrite) to the final destination file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket. More... | |
These routines handle opening & closing the ev lib for reading or writing to a file, buffer, or socket.
int evClose | ( | int | handle | ) |
This routine flushes any existing evio format data in an internal buffer (written to with evWrite) to the final destination file/socket/buffer opened with routines evOpen, evOpenBuffer, or evOpenSocket.
It also frees up the handle so it cannot be used any more without calling evOpen again. Any data written is in evio version 4 format and any opened file is closed. If reading, nothing is done.
handle | evio handle |
References evfilestruct::blknum, evfilestruct::bufSize, evfilestruct::bytesToBuf, EV_READFILE, EV_READPIPE, EV_WRITEBUF, EV_WRITEFILE, EV_WRITEPIPE, EV_WRITESOCK, evfilestruct::eventsToBuf, evfilestruct::file, evfilestruct::lockingOn, evfilestruct::mmapFile, evfilestruct::mmapFileSize, evfilestruct::randomAccess, evfilestruct::rw, S_EVFILE_BADHANDLE, S_FAILURE, and S_SUCCESS.
Referenced by evclose_(), and main().
int evOpen | ( | char * | filename, |
char * | flags, | ||
int * | handle | ||
) |
This function opens a file for either reading or writing evio format data.
Works with all versions of evio for reading, but only writes version 6 format. A handle is returned for use with calling other evio routines.
filename | name of file. Constructs of the form will be substituted with the given environmental variable or removed if nonexistent. Constructs of the form s will be substituted with the run type if specified in evIoctl or removed if nonexistent. Up to 2, C-style int format specifiers are allowed. The first is replaced with the run number (set in evIoctl). If splitting, the second is replaced by the split number, otherwise it's removed. If splitting and no second int specifier exists, a "." and split number are automatically appended to the end of the file name. |
flags | pointer to case-independent string of "w" for writing, "r" for reading, "a" for appending, "ra" for random access reading of a file which means memory mapping it, or "s" for splitting a file while writing. The w, r, a, s, or ra, may be followed by an x which means do not do any mutex locking (not thread safe). |
handle | pointer to int which gets filled with handle |
References S_EVFILE_BADARG.
int evOpenBuffer | ( | char * | buffer, |
uint32_t | bufLen, | ||
char * | flags, | ||
int * | handle | ||
) |
This function allows for either reading or writing evio format data from a buffer.
Works with all versions of evio for reading, but only writes version 6 format. A handle is returned for use with calling other evio routines.
buffer | pointer to buffer |
bufLen | length of buffer in 32 bit ints |
flags | pointer to case-independent string of "w", "r", "a", or "ra" for writing/reading/appending/random-access-reading to/from a buffer. The w, r, a, or ra, may be followed by an x which means do not do any mutex locking (not thread safe). |
handle | pointer to int which gets filled with handle |
References S_EVFILE_BADARG.
int evOpenSocket | ( | int | sockFd, |
char * | flags, | ||
int * | handle | ||
) |
This function allows for either reading or writing evio format data from a TCP socket.
Works with all versions of evio for reading, but only writes version 6 format. A handle is returned for use with calling other evio routines.
sockFd | TCP socket file descriptor |
flags | pointer to case-independent string of "w" & "r" for writing/reading to/from a socket The w or r, may be followed by an x which means do not do any mutex locking (not thread safe). |
handle | pointer to int which gets filled with handle |
References S_EVFILE_BADARG.