diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:11:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-07-17 07:11:12 +0000 |
commit | b72837827d9290c7ec50b9e4b9e1a0f194ddccca (patch) | |
tree | 8df663325413d0f92086d740638555de6b779df7 /src/input/fpcap.c | |
parent | Adding upstream version 1.1.0+debian. (diff) | |
download | dnsjit-be78963741e5f69dc1ef588ab7370152b98ef8bc.tar.xz dnsjit-be78963741e5f69dc1ef588ab7370152b98ef8bc.zip |
Adding upstream version 1.2.1.upstream/1.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/input/fpcap.c')
-rw-r--r-- | src/input/fpcap.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/input/fpcap.c b/src/input/fpcap.c index de054ec..6804608 100644 --- a/src/input/fpcap.c +++ b/src/input/fpcap.c @@ -24,6 +24,7 @@ #include "core/assert.h" #include "core/object/pcap.h" +#include <fcntl.h> #include <stdio.h> #ifdef HAVE_ENDIAN_H #include <endian.h> @@ -60,7 +61,7 @@ static input_fpcap_t _defaults = { 0, 0, 0, 0, 0, CORE_OBJECT_PCAP_INIT(0), - 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -91,6 +92,16 @@ static int _open(input_fpcap_t* self) { mlassert_self(); +#if _POSIX_C_SOURCE >= 200112L || defined(__FreeBSD__) + if (self->use_fadvise) { + int err = posix_fadvise(fileno((FILE*)self->file), 0, 0, POSIX_FADV_SEQUENTIAL); + if (err) { + lcritical("posix_fadvise() failed: %s", core_log_errstr(err)); + return -2; + } + } +#endif + if (fread(&self->magic_number, 1, 4, self->file) != 4 || fread(&self->version_major, 1, 2, self->file) != 2 || fread(&self->version_minor, 1, 2, self->file) != 2 |