Changeset 23971d0


Ignore:
Timestamp:
04/08/06 16:23:04 (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:
33e1501
Parents:
9ee7134
Message:

Portability fixes for windows

Location:
lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/dagformat.h

    r9de8150 r23971d0  
    4545        unsigned int   dserror:1;
    4646        unsigned int   pad:2;
    47 } __attribute__((packed)) flags_t;
     47} PACKED flags_t;
    4848
    4949/** GPP Global type */
     
    6161                aal5_rec_t      aal5;
    6262        } rec;
    63 } __attribute__((packed)) dag_record_t;
     63} PACKED dag_record_t;
    6464
    6565/** Dynamic(?) Universal Clock Kit Information packet */
  • lib/daglegacy.h

    r3b8a5ef r23971d0  
    55        uint64_t  ts;
    66        uint32_t  crc;
    7 } __attribute__ ((packed)) legacy_cell_t;
     7} PACKED legacy_cell_t;
    88
    99typedef struct legacy_ether {
    1010        uint64_t  ts;
    1111        uint16_t  wlen;
    12 } __attribute__ ((packed)) legacy_ether_t;
     12} PACKED legacy_ether_t;
    1313
    1414typedef struct legacy_pos {
     
    1616        uint32_t  slen;
    1717        uint32_t  wlen;
    18 } __attribute__ ((packed)) legacy_pos_t;
     18} PACKED legacy_pos_t;
    1919
    2020#endif
  • lib/format_erf.c

    r6b2d5ed r23971d0  
    3737#include "parse_cmd.h"
    3838
    39 #ifdef HAVE_INTTYPES_H
    40 #  include <inttypes.h>
    41 #else
    42 #  error "Can't find inttypes.h - this needs to be fixed"
    43 #endif
    44 
    45 #ifdef HAVE_STDDEF_H
    46 #  include <stddef.h>
    47 #else
    48 # error "Can't find stddef.h - do you define ptrdiff_t elsewhere?"
    49 #endif
    50 #include <sys/types.h>
    51 #include <sys/socket.h>
    52 #include <sys/un.h>
    53 #include <sys/mman.h>
    54 #include <sys/stat.h>
    55 #include <unistd.h>
    5639#include <assert.h>
    5740#include <errno.h>
    58 #include <netdb.h>
    5941#include <fcntl.h>
    6042#include <stdio.h>
    6143#include <string.h>
    6244#include <stdlib.h>
     45
     46#ifdef WIN32
     47#  include <io.h>
     48#  include <share.h>
     49#  define PATH_MAX _MAX_PATH
     50#  define snprintf sprintf_s
     51#else
     52#  include <netdb.h>
     53#endif
    6354
    6455
     
    373364        remote.sin_port = htons(CONNINFO.rt.port);
    374365        remote.sin_addr = *((struct in_addr *)he->h_addr);
    375         bzero(&(remote.sin_zero), 8);
     366        memset(&(remote.sin_zero), 0, 8);
    376367
    377368        if (connect(INPUT.fd, (struct sockaddr *)&remote,
     
    10141005};
    10151006
    1016 void __attribute__((constructor)) erf_constructor() {
     1007void CONSTRUCTOR erf_constructor() {
    10171008        register_format(&rtclient);
    10181009        register_format(&erf);
  • lib/format_helper.c

    r6b2d5ed r23971d0  
    3939#include <string.h>
    4040#include <errno.h>
    41 #ifdef HAVE_INTTYPES_H
    42 #  include <inttypes.h>
    43 #else
    44 #  error "Can't find inttypes.h - this needs to be fixed"
    45 #endif
    4641#include  "format_helper.h"
    4742
     
    4944#include <assert.h>
    5045#include <stdarg.h>
     46
     47#ifdef WIN32
     48#  include <io.h>
     49#  include <share.h>
     50#  define snprintf sprintf_s
     51
     52struct libtrace_eventobj_t trace_event_device(struct libtrace_t *trace, struct libtrace_packet_t *packet) {
     53    struct libtrace_eventobj_t event = {0,0,0.0,0};
     54
     55    trace_set_err(trace,TRACE_ERR_OPTION_UNAVAIL, "trace_event() is not "
     56            "supported on devices under windows in this version");
     57
     58    event.type = TRACE_EVENT_TERMINATE;
     59    return event;
     60}
     61#else
     62#  include <sys/ioctl.h>
    5163
    5264struct libtrace_eventobj_t trace_event_device(struct libtrace_t *trace, struct libtrace_packet_t *packet) {
     
    7587        return event;
    7688}
     89#endif
    7790
    7891struct libtrace_eventobj_t trace_event_trace(struct libtrace_t *trace, struct libtrace_packet_t *packet) {
  • lib/libtrace.h

    r67a14d4 r23971d0  
    7373#  define UNUSED __attribute__((unused))
    7474#  define PACKED __attribute__((packed))
     75#  define CONSTRUCTOR __attribute__((constructor))
    7576#else
    7677#  define SIMPLE_FUNCTION
    7778#  define UNUSED
     79#  define PACKED
     80#  define CONSTRUCTOR
    7881#endif
    7982       
Note: See TracChangeset for help on using the changeset viewer.