From 6b414c082f0079664c0535963108ae4a648dba47 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 3 Nov 2009 14:18:11 -0800 Subject: [PATCH] Describe all the cases where pcap_fileno() returns a file descriptor and where it returns -1. Based on a patch from Fumiyuki Shimizu. --- CREDITS | 1 + pcap_fileno.3pcap | 37 +++++++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/CREDITS b/CREDITS index 326afa5..dbe26a6 100644 --- a/CREDITS +++ b/CREDITS @@ -38,6 +38,7 @@ Additional people who have contributed patches: Florent Drouin Franz Schaefer Fulko Hew + Fumiyuki Shimizu Gianluca Varenni Gilbert Hoyek Gisle Vanem diff --git a/pcap_fileno.3pcap b/pcap_fileno.3pcap index 28eac42..02d24b5 100644 --- a/pcap_fileno.3pcap +++ b/pcap_fileno.3pcap @@ -33,15 +33,36 @@ int pcap_fileno(pcap_t *p); .ft .fi .SH DESCRIPTION -.B pcap_fileno() -returns the file descriptor number from which captured packets are read, -if a network device was opened with +If +.I p +refers to a network device that was opened for a live capture using +a combination of .B pcap_create() and -.B pcap_activate() -or with +.BR pcap_activate() , +or using .BR pcap_open_live() , -or \-1, if a ``savefile'' was opened with -.BR pcap_open_offline() . +.B pcap_fileno() +returns the file descriptor from which captured packets are read. +.LP +If +.I p +refers to a ``savefile'' that was opened using fuctions such as +.BR pcap_open_offline() +or +.BR pcap_fopen_offline() , +a ``dead'' +.B pcap_t +opened using +.BR pcap_open_dead() , +or a +.B pcap_t +that was created with +.B pcap_create() +but that has not yet been activated with +.BR pcap_activate() , +it returns \-1. .SH SEE ALSO -pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP) +pcap(3PCAP), pcap_create(3PCAP), pcap_activate(3PCAP), +pcap_open_live(3PCAP), pcap_open_offline(3PCAP), +pcap_fopen_offline(3PCAP), pcap_open_dead(3PCAP)