--- libaitio/example/bpf.c 2013/06/25 09:08:10 1.1.2.1 +++ libaitio/example/bpf.c 2013/06/25 16:42:41 1.1.2.4 @@ -37,6 +37,8 @@ #include #endif +#include + #ifndef roundup #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) /* to any y */ #endif @@ -261,9 +263,7 @@ main(int argc, char **argv) pthread_t tid; char ch, mode = 'R'; struct timespec ts_start, ts_end; -#ifdef __FreeBSD__ - struct bpf_zbuf *bz; -#endif + void *bz = NULL; while ((ch = getopt(argc, argv, "hvwzs:p:f:")) != -1) switch (ch) { @@ -299,10 +299,12 @@ main(int argc, char **argv) else strlcpy(szStr, *argv, sizeof szStr); -#ifdef __FreeBSD_ - dev = io_etherOpen(szStr, O_RDWR | O_NONBLOCK, 42, &siz, &bz); +#ifdef __FreeBSD__ + dev = io_etherOpen(szStr, O_RDWR, 42, (u_int*) &siz, &bz); + if (dev == -1) + dev = io_etherOpen(szStr, O_RDWR, 42, (u_int*) &siz, NULL); #else - dev = io_etherOpen(szStr, O_RDWR | O_NONBLOCK, 42, &siz, NULL); + dev = io_etherOpen(szStr, O_RDWR, 42, (u_int*) &siz, NULL); #endif if (dev == -1) { printf("Error:: #%d - %s\n", io_GetErrno(), io_GetError());