Sponsored Content
Full Discussion: select vs poll
Special Forums IP Networking select vs poll Post 302115848 by porter on Saturday 28th of April 2007 09:24:17 AM
Old 04-28-2007
Quote:
Originally Posted by smanu
Porter: How do I check if my system is BSD derived or V derived?
There are a number of ways but here we are trying to find out if select or poll is the more fundamental call. A suggestion is to look at sys/syscall.h and see if SYS_select or SYS_poll exist. If both exist then *maybe* both are native, but for instance not in the case of Darwin. In that case you could check to see which is the "earlier" call, ie if SYS_select is less than SYS_poll.
 

7 More Discussions You Might Find Interesting

1. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies

2. UNIX for Dummies Questions & Answers

Replace select/poll with kqueue/kevent

Hi, As far as I known, kqueue/kevent model can be used to improve the efficiency of systems event dispatching. I m wondering whether kqueue/kevent is same as the real-time OS event model. I also want to know when writing multiplexing app in real-time OS, what APIs need to be used for... (1 Reply)
Discussion started by: bsderss
1 Replies

3. Programming

select/poll and Signal Safety

Hi I am struggling to understand why one should use pselect()/ppoll() instead of wrapping an ordinary select() or poll() call around sigprocmask(). The linux man page talks about “race conditions”, but how would such dangers occur? I plan to use poll() for an application (since ppoll() isn't... (0 Replies)
Discussion started by: nopcoder
0 Replies

4. UNIX for Dummies Questions & Answers

Poll data from a file

I have to write a script where I poll a txt file for data (30 min interval) Dependent on the data read, the script should return a message. It should look something like the "code" below: -- do while <data recived> sleep 30m read data from file Done If <data> x return "A" If... (1 Reply)
Discussion started by: ioniCoder
1 Replies

5. Shell Programming and Scripting

how to poll for new files?

Hi , i have a requirement in which i have to ftp files to unix from windows and vice versa. I have to encrypt files in windows which will then be decrypted in unix and vice versa. Now the process needs to be automated ..therefore when windows server or unix server recieves the files a shell... (5 Replies)
Discussion started by: lifzgud
5 Replies

6. Shell Programming and Scripting

How to use poll() for I/O multiplex

Hi, guys: I want to write my own shell using C. I am confused about the usage of I/O multiplex. Does anyone know some examples or explain it to me ? Thanks so much (1 Reply)
Discussion started by: tomlee
1 Replies

7. What is on Your Mind?

Powerhouses and mainstream poll

This not a joke but a quite serious question to maybe have your point of view about this very topic of content on the net. So I start this poll to ask the users if they can imagine that the so called content industry of former times sooner or later or anyway will regain lost ground or not? Do you... (1 Reply)
Discussion started by: 1in10
1 Replies
PCAP_GET_SELECTABLE_FD(3PCAP)											     PCAP_GET_SELECTABLE_FD(3PCAP)

NAME
pcap_get_selectable_fd - get a file descriptor on which a select() can be done for a live capture SYNOPSIS
#include <pcap/pcap.h> int pcap_get_selectable_fd(pcap_t *p); DESCRIPTION
pcap_get_selectable_fd() returns, on UNIX, a file descriptor number for a file descriptor on which one can do a select() or poll() to wait for it to be possible to read packets without blocking, if such a descriptor exists, or -1, if no such descriptor exists. Some network devices opened with pcap_create() and pcap_activate(), or with pcap_open_live(), do not support select() or poll() (for example, regular network devices on FreeBSD 4.3 and 4.4, and Endace DAG devices), so -1 is returned for those devices. Note that in: FreeBSD prior to FreeBSD 4.6; NetBSD prior to NetBSD 3.0; OpenBSD prior to OpenBSD 2.4; Mac OS X prior to Mac OS X 10.7; select() and poll() do not work correctly on BPF devices; pcap_get_selectable_fd() will return a file descriptor on most of those versions (the exceptions being FreeBSD 4.3 and 4.4), but a simple select() or poll() will not indicate that the descriptor is readable until a full buffer's worth of packets is received, even if the read timeout expires before then. To work around this, an application that uses select() or poll() to wait for packets to arrive must put the pcap_t in non-blocking mode, and must arrange that the select() or poll() have a timeout less than or equal to the read timeout, and must try to read packets after that timeout expires, regardless of whether select() or poll() indicated that the file descriptor for the pcap_t is ready to be read or not. (That workaround will not work in FreeBSD 4.3 and later; however, in FreeBSD 4.6 and later, select() and poll() work correctly on BPF devices, so the workaround isn't necessary, although it does no harm.) Note also that poll() doesn't work on character special files, including BPF devices, in Mac OS X 10.4 and 10.5, so, while select() can be used on the descriptor returned by pcap_get_selectable_fd(), poll() cannot be used on it those versions of Mac OS X. Kqueues also don't work on that descriptor. poll(), but not kqueues, work on that descriptor in Mac OS X releases prior to 10.4; poll() and kqueues work on that descriptor in Mac OS X 10.6 and later. pcap_get_selectable_fd() is not available on Windows. RETURN VALUE
A selectable file descriptor is returned if one exists; otherwise, -1 is returned. SEE ALSO
pcap(3PCAP), select(2), poll(2) 5 April 2008 PCAP_GET_SELECTABLE_FD(3PCAP)
All times are GMT -4. The time now is 05:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy