Ignore:
Timestamp:
02/20/06 18:36:13 (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:
5b91b48
Parents:
8ee7caa
Message:

Fixed up erf output
Force trace_create_packet to be called, don't let people cheat.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_helper.c

    r3d4d52d r0a6638f  
    4646
    4747#include <sys/ioctl.h>
     48#include <assert.h>
    4849
    4950struct libtrace_eventobj_t trace_event_device(struct libtrace_t *trace, struct libtrace_packet_t *packet) {
     
    165166        return ret;
    166167}
     168
     169LIBTRACE_FILE trace_open_file_out(libtrace_out_t *trace,int level, int fileflag)
     170{
     171        int fd;
     172        LIBTRACE_FILE ret;
     173        char filemode[4]; /* wb9\0 */
     174        assert(level<10);
     175        assert(level>=0);
     176#if HAVE_ZLIB
     177        sprintf(filemode,"wb%d",level);
     178#else
     179        sprintf(filemode,"w");
     180#endif
     181
     182        if (strcmp(trace->uridata,"-")==0) {
     183                ret=LIBTRACE_FDOPEN(fileno(stdout),filemode);
     184                return ret;
     185        }
     186
     187        /* We open the file with open(2), so we can provide O_LARGEFILE
     188         * as zlib doesn't always do it itself
     189         */
     190        fd=open(trace->uridata,fileflag,0666);
     191        if (fd==-1) {
     192                trace_set_err(errno,"Unable to open %s",trace->uridata);
     193                return 0;
     194        }
     195        ret=LIBTRACE_FDOPEN(fd,filemode);
     196        if (ret==NULL) {
     197                printf("%s\n",filemode);
     198                trace_set_err(TRACE_ERR_INIT_FAILED,"gz out of memory");
     199        }
     200        return ret;
     201}
     202
     203
     204
Note: See TracChangeset for help on using the changeset viewer.