Changeset 33e1501


Ignore:
Timestamp:
04/08/06 16:31:40 (15 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:
689c220
Parents:
23971d0
Message:

WIN32 compile fixes

Location:
lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/format_legacy.c

    r68155f1 r33e1501  
    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>
    5439#include <sys/stat.h>
    55 #include <unistd.h>
    5640#include <assert.h>
    5741#include <errno.h>
    58 #include <netdb.h>
    5942#include <fcntl.h>
    6043#include <stdio.h>
     
    6245#include <stdlib.h>
    6346
    64 
    65 #define COLLECTOR_PORT 3435
     47#ifdef WIN32
     48#  include <io.h>
     49#  include <share.h>
     50#  define snprintf sprintf_s
     51#endif
     52
    6653
    6754/* Catch undefined O_LARGEFILE on *BSD etc */
     
    182169}
    183170
    184 static int legacy_get_capture_length(const struct libtrace_packet_t *packet __attribute__((unused))) {
     171static int legacy_get_capture_length(const struct libtrace_packet_t *packet UNUSED) {
    185172        return 64;
    186173}
     
    345332
    346333       
    347 static void __attribute__((constructor)) legacy_constructor() {
     334static void CONSTRUCTOR legacy_constructor() {
    348335        register_format(&legacypos);
    349336        register_format(&legacyeth);
  • lib/format_pcap.c

    r67a14d4 r33e1501  
    3535#include "format_helper.h"
    3636
    37 #ifdef HAVE_INTTYPES_H
    38 #  include <inttypes.h>
    39 #else
    40 #  error "Can't find inttypes.h - this needs to be fixed"
    41 #endif
    42 
    43 #include <sys/types.h>
    4437#include <sys/stat.h>
    45 #include <unistd.h>
    4638#include <assert.h>
    4739#include <stdio.h>
  • lib/format_rt.c

    r68155f1 r33e1501  
    4040#include "rt_protocol.h"
    4141
    42 #ifdef HAVE_INTTYPES_H
    43 #  include <inttypes.h>
    44 #else
    45 #  error "Can't find inttypes.h - this needs to be fixed"
    46 #endif
    47 
    48 #ifdef HAVE_STDDEF_H
    49 #  include <stddef.h>
    50 #else
    51 # error "Can't find stddef.h - do you define ptrdiff_t elsewhere?"
    52 #endif
    53 #include <sys/types.h>
    54 #include <sys/socket.h>
    55 #include <sys/un.h>
    56 #include <sys/mman.h>
    5742#include <sys/stat.h>
    58 #include <unistd.h>
    5943#include <assert.h>
    6044#include <errno.h>
    61 #include <netdb.h>
    6245#include <fcntl.h>
    6346#include <stdio.h>
    6447#include <string.h>
    6548#include <stdlib.h>
     49
     50#ifndef WIN32
     51# include <netdb.h>
     52#endif
    6653
    6754#define RT_INFO ((struct rt_format_data_t*)libtrace->format_data)
     
    114101        rt_hello_t hello_opts;
    115102        uint8_t reason;
    116         int oldflags;
    117 
    118103       
    119104        if ((he=gethostbyname(RT_INFO->hostname)) == NULL) {
     
    129114        remote.sin_port = htons(RT_INFO->port);
    130115        remote.sin_addr = *((struct in_addr *)he->h_addr);
    131         bzero(&(remote.sin_zero), 8);
     116        memset(&(remote.sin_zero), 0, 8);
    132117
    133118        if (connect(RT_INFO->input_fd, (struct sockaddr *)&remote,
     
    286271static int rt_read(struct libtrace_t *libtrace, void **buffer, size_t len, int block) {
    287272        int numbytes;
    288         int i;
    289273        char *buf_ptr;
    290274
     
    296280                RT_INFO->buf_left = 0;
    297281        }
     282
     283#ifndef MSG_DONTWAIT
     284#define MSG_DONTWAIT 0
     285#endif
    298286
    299287        if (block)
     
    674662};
    675663
    676 void __attribute__((constructor)) rt_constructor() {
     664void CONSTRUCTOR rt_constructor() {
    677665        register_format(&rt);
    678666}
  • lib/format_template.c

    rf3ed52a r33e1501  
    3434#include "config.h"
    3535#include "stdlib.h"
    36 
    37 #ifdef HAVE_INTTYPES_H
    38 #  include <inttypes.h>
    39 #else
    40 # error "Can't find inttypes.h"
    41 #endif
    4236
    4337static struct libtrace_format_t template;
  • lib/format_wag.c

    rc7658ea r33e1501  
    3737#include "wag.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 <time.h>
    52 #include <sys/socket.h>
    53 #include <sys/un.h>
    54 #include <sys/mman.h>
    5539#include <sys/stat.h>
    5640#include <fcntl.h>
    57 #include <unistd.h>
    5841#include <assert.h>
    5942#include <errno.h>
    60 #include <netdb.h>
    6143#include <stdio.h>
    6244#include <string.h>
     
    6951#ifdef HAVE_SYS_LIMITS_H
    7052#  include <sys/limits.h>
     53#endif
     54
     55#ifdef WIN32
     56#  include <io.h>
     57#  include <share.h>
    7158#endif
    7259
     
    123110                return -1;
    124111        }
     112#ifndef WIN32
    125113        if (S_ISCHR(buf.st_mode)) {
    126114                INPUT.fd = open(libtrace->uridata, O_RDONLY);
    127         } else {
    128                 trace_set_err(libtrace,TRACE_ERR_INIT_FAILED,
    129                                 "%s is not a valid char device",
    130                                 libtrace->uridata);
    131                 return -1;
    132         }
    133         return 0;
     115                return 0;
     116        }
     117#endif
     118        trace_set_err(libtrace,TRACE_ERR_INIT_FAILED,
     119                        "%s is not a valid char device",
     120                        libtrace->uridata);
     121        return -1;
    134122}
    135123
     
    379367}
    380368
    381 static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet __attribute__((unused))) {
     369static libtrace_linktype_t wag_get_link_type(const struct libtrace_packet_t *packet UNUSED) {
    382370        return TRACE_TYPE_80211;
    383371}
     
    517505
    518506
    519 void __attribute__((constructor)) wag_constructor() {
     507void CONSTRUCTOR wag_constructor() {
    520508        register_format(&wag);
    521509        register_format(&wag_trace);
Note: See TracChangeset for help on using the changeset viewer.