]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libpcap/pcap_get_required_select_timeout.3pcap
Optionally bind ktls threads to NUMA domains
[FreeBSD/FreeBSD.git] / contrib / libpcap / pcap_get_required_select_timeout.3pcap
1 .\" Copyright (c) 1994, 1996, 1997
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that: (1) source code distributions
6 .\" retain the above copyright notice and this paragraph in its entirety, (2)
7 .\" distributions including binary code include the above copyright notice and
8 .\" this paragraph in its entirety in the documentation or other materials
9 .\" provided with the distribution, and (3) all advertising materials mentioning
10 .\" features or use of this software display the following acknowledgement:
11 .\" ``This product includes software developed by the University of California,
12 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 .\" the University nor the names of its contributors may be used to endorse
14 .\" or promote products derived from this software without specific prior
15 .\" written permission.
16 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 .\"
20 .TH PCAP_GET_REQUIRED_SELECT_TIMEOUT 3PCAP "25 July 2018"
21 .SH NAME
22 pcap_get_required_select_timeout \- get a file descriptor on which a
23 select() can be done for a live capture
24 .SH SYNOPSIS
25 .nf
26 .ft B
27 #include <pcap/pcap.h>
28 .ft
29 .LP
30 .ft B
31 struct timeval *pcap_get_required_select_timeout(pcap_t *p);
32 .ft
33 .fi
34 .SH DESCRIPTION
35 .B pcap_get_required_select_timeout()
36 returns, on UNIX, a pointer to a
37 .B struct timeval
38 containing a value that must be used as the minimum timeout in
39 .BR select(2) ,
40 .BR poll(2) ,
41 .BR epoll_wait(2) ,
42 and
43 .B kevent()
44 calls if
45 .B pcap_get_selectable_fd(3PCAP)
46 returns
47 .BR PCAP_ERROR .
48 .PP
49 The timeout that should be used in those calls must be no larger than
50 the smallest of all timeouts returned by
51 .B \%pcap_get_required_select_timeout()
52 for devices from which packets will be captured.
53 .PP
54 The device for which
55 .B pcap_get_selectable_fd()
56 returned
57 .B PCAP_ERROR
58 must be put in non-blocking mode with
59 .BR pcap_setnonblock(3PCAP) ,
60 and an attempt must always be made to read packets from the device
61 when the
62 .BR select() ,
63 .BR poll() ,
64 .BR epoll_wait() ,
65 or
66 .B kevent()
67 call returns.
68 .PP
69 Note that a device on which a read can be done without blocking may,
70 on some platforms, not have any packets to read if the packet buffer
71 timeout has expired.  A call to
72 .B pcap_dispatch(3PCAP)
73 or
74 .B pcap_next_ex(3PCAP)
75 will return 0 in this case, but will not block.
76 .PP
77 .B pcap_get_required_select_timeout()
78 is not available on Windows.
79 .SH RETURN VALUE
80 A pointer to a
81 .B struct timeval
82 is returned if the timeout is required; otherwise
83 .B NULL
84 is returned.
85 .SH BACKWARD COMPATIBILITY
86 This function became available in libpcap release 1.9.0.  In previous
87 releases,
88 .BR select() ,
89 .BR poll() ,
90 .BR epoll_wait() ,
91 and
92 .B kevent()
93 cannot be used on any capture source for which
94 .B pcap_get_selectable_fd
95 returns \-1.
96 .SH SEE ALSO
97 pcap(3PCAP), pcap_get_selectable_fd(3PCAP), select(2), poll(2),
98 epoll_wait(2), kqueue(2)