summaryrefslogtreecommitdiff
path: root/pcap_sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'pcap_sg.c')
-rw-r--r--pcap_sg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pcap_sg.c b/pcap_sg.c
index ad78ce7..6902001 100644
--- a/pcap_sg.c
+++ b/pcap_sg.c
@@ -146,6 +146,11 @@ static void pcap_sg_fsync(int fd)
fdatasync(fd);
}
+static void pcap_sg_init_once(void)
+{
+ set_ioprio_rt();
+}
+
static int pcap_sg_prepare_access(int fd, enum pcap_mode mode, bool jumbo)
{
int i, ret;
@@ -160,8 +165,6 @@ static int pcap_sg_prepare_access(int fd, enum pcap_mode mode, bool jumbo)
iov[i].iov_len = len;
}
- set_ioprio_rt();
-
if (mode == PCAP_MODE_RD) {
ret = readv(fd, iov, array_size(iov));
if (ret <= 0)
@@ -183,6 +186,7 @@ static void pcap_sg_prepare_close(int fd, enum pcap_mode mode)
}
const struct pcap_file_ops pcap_sg_ops = {
+ .init_once_pcap = pcap_sg_init_once,
.pull_fhdr_pcap = pcap_generic_pull_fhdr,
.push_fhdr_pcap = pcap_generic_push_fhdr,
.prepare_access_pcap = pcap_sg_prepare_access,