do not support the SIGINFO signal, the same can be achieved by using the
SIGUSR1 signal.
.LP
+Using the SIGUSR2 signal along with the
+.B \-w
+flag will forcibly flush the packet buffer into the output file.
+.LP
Reading packets from a network interface may require that you have
special privileges; see the
.B pcap (3PCAP)
#define SIGNAL_REQ_INFO SIGUSR1
#endif
+#if defined(HAVE_PCAP_DUMP_FLUSH) && defined(SIGUSR2)
+#define SIGNAL_FLUSH_PCAP SIGUSR2
+#endif
+
static int Bflag; /* buffer size */
#ifdef HAVE_PCAP_DUMP_FTELL64
static int64_t Cflag; /* rotate dump files after this many bytes */
void requestinfo(int);
#endif
+#ifdef SIGNAL_FLUSH_PCAP
+void flushpcap(int);
+#endif
+
#ifdef _WIN32
static HANDLE timer_handle = INVALID_HANDLE_VALUE;
static void CALLBACK verbose_stats_dump(PVOID param, BOOLEAN timer_fired);
if (RFileName == NULL)
(void)setsignal(SIGNAL_REQ_INFO, requestinfo);
#endif
+#ifdef SIGNAL_FLUSH_PCAP
+ (void)setsignal(SIGNAL_FLUSH_PCAP, flushpcap);
+#endif
if (ndo->ndo_vflag > 0 && WFileName && !print) {
/*
++infoprint;
else
info(0);
-
-#ifdef HAVE_PCAP_DUMP_FLUSH
- if (p != NULL)
- pcap_dump_flush(p);
+}
#endif
+
+#ifdef SIGNAL_FLUSH_PCAP
+void flushpcap(int signo _U_)
+{
+ if (p != NULL)
+ pcap_dump_flush(p);
}
#endif