Changeset 698a217 for lib/libtraceio.h


Ignore:
Timestamp:
04/23/06 14:21:02 (16 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
e4e95499
Parents:
4315572b
Message:

Fix the stdio error handling
Document better the libtraceio API. See the trac wiki for more information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtraceio.h

    redb18ce r698a217  
    1010typedef struct libtrace_io_t libtrace_io_t;
    1111
     12/** read a block from a file
     13 * @param io    the io file object
     14 * @param buf   the buffer to read into
     15 * @param len   the number of bytes to read
     16 *
     17 * @returns -1 on error (with errno set), 0 on eof, otherwise the number of bytes
     18 *      read.
     19 */
    1220ssize_t libtrace_io_read(libtrace_io_t *io, void *buf, size_t len);
     21/** open a file from a file descriptor (like fdopen(3))
     22 * @param fd    file descriptor to read
     23 * @param mode  text string to represent what mode to read the file in.
     24 *
     25 * @returns io object, or NULL on error.
     26 */
    1327libtrace_io_t *libtrace_io_fdopen(int fd, const char *mode);
     28/** open a file from a path name
     29 * @param path  pathname to read
     30 * @param mode  text string to represent what mode to read the file in.
     31 *
     32 * @returns io object, or NULL on error.
     33 */
    1434libtrace_io_t *libtrace_io_open(const char *path, const char *mode);
     35/** close a file and free all of it's resources.
     36 * @param io    io object
     37 *
     38 * This function doesn't return anything.  In theory it could return an error
     39 * but seriously, if it did return an error, what would you do about it?
     40 */
    1541void libtrace_io_close(libtrace_io_t *io);
     42
     43/** write a block of data to a file
     44 * @param io    libtrace io object to write to
     45 * @param buf   buffer to write to
     46 * @param len   number of bytes to write
     47 *
     48 * @returns the number of bytes successfully written, or -1 on error with
     49 * errno set
     50 */
    1651ssize_t libtrace_io_write(libtrace_io_t *io, const void *buf, size_t len);
    1752off_t libtrace_io_seek(libtrace_io_t *io, off_t offset, int whence);
Note: See TracChangeset for help on using the changeset viewer.