Skip to content
Snippets Groups Projects
Commit d382afb8 authored by David Johnson's avatar David Johnson
Browse files

Fixup some of this pcap and pthread stuff, and don't build nfsdump on

linux.
parent 1756fefb
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,17 @@ SUBDIR = sensors/nfstrace
NFSTRACESUPPORT = @NFSTRACESUPPORT@
SYSTEM = $(shell uname -s)
STUFF = nfstrace.proxy nfsdump2db nfsdump nfstrace.init
# XXX ugh, but we don't use this and nfsdump won't compile on linux
ifeq ($(SYSTEM),Linux)
STUFF = nfstrace.proxy nfsdump2db nfstrace.init
endif
include $(OBJDIR)/Makeconf
all: nfstrace.proxy nfsdump2db nfsdump nfstrace.init
all: $(STUFF)
include $(TESTBED_SRCDIR)/GNUmakerules
......
......@@ -17,7 +17,7 @@
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /home/cvs_mirrors/cvs-public.flux.utah.edu/CVS/testbed/sensors/nfstrace/nfsdump2/Makefile.in,v 1.2 2006-02-02 16:16:17 stack Exp $ (LBL)
# @(#) $Header: /home/cvs_mirrors/cvs-public.flux.utah.edu/CVS/testbed/sensors/nfstrace/nfsdump2/Makefile.in,v 1.2.18.1 2009-11-06 00:00:57 johnsond Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
......@@ -37,12 +37,23 @@ CCOPT = @V_CCOPT@
INCLS = -I. @V_INCLS@
DEFS = @DEFS@
SYSTEM = $(shell uname -s)
# Standard CFLAGS
CFLAGS = $(CCOPT) $(DEFS) $(INCLS) -g -I/usr/local/include/pthread -I/usr/local/include/pthread/linuxthreads
CFLAGS = $(CCOPT) $(DEFS) $(INCLS) -g
ifneq ($(SYSTEM),Linux)
CFLAGS += -I/usr/local/include/pthread -I/usr/local/include/pthread/linuxthreads
endif
# Standard LDFLAGS
#LDFLAGS = @LDFLAGS@ -pthread
LDFLAGS = @LDFLAGS@ -L/usr/local/lib -llthread -llgcc_r
LDFLAGS = @LDFLAGS@
ifneq ($(SYSTEM),Linux)
LDFLAGS += -L/usr/local/lib -llthread -llgcc_r
else
LDFLAGS += -lpthread
endif
# Standard LIBS
LIBS = @LIBS@
......
......@@ -3,8 +3,16 @@
#include <errno.h>
#include <stdlib.h>
#ifdef __linux__
#include <unistd.h>
#include <pthread.h>
#include <pcap.h>
#include <pcap-int.h>
#include <pcap-bpf.h>
#else
#include <linuxthreads/pthread.h>
#include <pcap-int.h>
#endif
#include "listNode.h"
......@@ -122,12 +130,23 @@ int mypcap_read(pcap_t *pd, void *user)
/*
* Loop through each packet.
*/
#ifdef __linux__
#define BPF_ALIGNMENT sizeof(long)
#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))
#define bhp ((struct pcap_pkthdr *)bp)
#else
#define bhp ((struct bpf_hdr *)bp)
#endif
ep = bp + cc;
while (bp < ep) {
register int caplen, hdrlen;
#ifdef __linux__
caplen = bhp->caplen;
hdrlen = bhp->len;
#else
caplen = bhp->bh_caplen;
hdrlen = bhp->bh_hdrlen;
#endif
/*
* XXX A bpf_hdr matches a pcap_pkthdr.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment