Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Man 2 POLL
@ 1998-01-05 18:55 Uncle George
  0 siblings, 0 replies; 7+ messages in thread
From: Uncle George @ 1998-01-05 18:55 UTC (permalink / raw)


thanks, it just that i wanted to know what the last parameter of the
POLL() ment. a 0 timeout means just that - dont wait at all ( rather than
a select for which that same field would mean wait forever - if i just
placed a 0 there also ) i just wanted to know if I had to wait forever, or
wait not at all.

thanks to u all

Miguel de Icaza wrote:

> > >         system call called poll().
> >
> > I don't think you'll find this on Linux.
> > Usually, select () is use instead.
>
> poll() is available in the 2.1.xx kernels.
>
> the kernel select system call on those kernels is implemented in terms
> of the poll system call (which happens to be a better interface).
>
> Miguel.
>
> --
> To unsubscribe:
> mail -s unsubscribe redhat-devel-list-request@redhat.com < /dev/null

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Man 2 POLL
@ 1998-01-05 17:11 Miguel de Icaza
  0 siblings, 0 replies; 7+ messages in thread
From: Miguel de Icaza @ 1998-01-05 17:11 UTC (permalink / raw)


> >         system call called poll().
> 
> I don't think you'll find this on Linux.
> Usually, select () is use instead.

poll() is available in the 2.1.xx kernels.

the kernel select system call on those kernels is implemented in terms
of the poll system call (which happens to be a better interface).

Miguel.

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <34AE5A68.42D84C5@voicenet.com>]
* Re: Man 2 POLL
@ 1998-01-03 18:57 Stefan Traby
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Traby @ 1998-01-03 18:57 UTC (permalink / raw)


Hi !

> does anyone know where i kan find some info on the
> 
>         system call called poll().

poll is the System V version of BSD's "select" call.

For Linux, use select. (see man 2 select)

Poll and select blocks until some or more specified fid's change their status,
or there are data available or it's possible to send nonblocking to a specific
fid. if it returns < -1 it's good idea to check errno for EINTR (interrupted
system call) select is also often used to sleep for a very short time.
We call this "I/O-multiplexing" here in Austria... :-)

The name for poll is really bad. In reality the process (or thread) goes for
sleep until the kernel wakes it up. Under Linux, this may be done by device
events if the driver has a non NULL "select"-field in struct file_operations.
The kernel supports select_wait to wake up sleeping threads.
You can make very fast event-driven kernel/userspace interfaces with select
on both sides.  

To see select under heavy load with checking hundreds of fid's try:
"strace emacs" (no joke)
If you want really work with emacs while doing this (Ctrl-L does not really
help) try "strace emacs 2>strace.out ; emacs strace.out" 

Another hint: There is maybe no man-page for poll.

Maybe you want a simple prototype for poll:

int poll(struct pollfd fdarray[], unsigned long nfds, int timeout);

struct pollfd {
	int fd; /* file descriptors to check */
	short events; /* events you want to look for */
	short revents; /* returned events */
}

Events are something like "POLLIN", "POLLRDNORM", "POLLRDBAND", "POLLPRI",
"POLLOUT", "POLLWRNORM", "POLLWRBAND", "POLLERR", "POLLHUP", "POLLNVAL".
The last three of them are returned only (revents).

Timeout field: "INFTIM" for forever, 0 for "fast check", and > 0 for
a timeout in ms. To get "INFTIM" you must include <stropts.h> on some
(or all System-V) systems.

That should be enough to port a poll to select. (execpt for a async sig
like POLLHUP, but who want a real working port under linux...)

-- 
  ciao - 
    Stefan

Stefan Traby                            phone:  +43-3133-6107-2
Mitterlasznitzstr. 13                     fax:  +43-3133-6107-9
8302 Nestelbach                        mailto://stefan@sime.com
Austria

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: Man 2 POLL
@ 1998-01-03 15:34 Uncle George
  0 siblings, 0 replies; 7+ messages in thread
From: Uncle George @ 1998-01-03 15:34 UTC (permalink / raw)


is that somewhere on-line? i suppose lots of people would pay 30-60 bucks
for info on
a unix call

Tom Linden wrote:

> Try "Advanced Programming in the Unix Environment" by W. Richard Stevens
> Addison Wesley 1992
>
> On Sat, 3 Jan 1998, Uncle George wrote:
>
> > does anyone know where i kan find some info on the
> >
> >         system call called poll().
> > gat
> >

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <34AE3315.2DBD560C@voicenet.com>]
* Man 2 POLL
@ 1998-01-03 12:46 Uncle George
  0 siblings, 0 replies; 7+ messages in thread
From: Uncle George @ 1998-01-03 12:46 UTC (permalink / raw)


does anyone know where i kan find some info on the

        system call called poll().
gat

-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1998-01-05 18:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-01-05 18:55 Man 2 POLL Uncle George
  -- strict thread matches above, loose matches on Subject: below --
1998-01-05 17:11 Miguel de Icaza
     [not found] <34AE5A68.42D84C5@voicenet.com>
1998-01-03 23:36 ` Tom Linden
1998-01-03 18:57 Stefan Traby
1998-01-03 15:34 Uncle George
     [not found] <34AE3315.2DBD560C@voicenet.com>
1998-01-03 15:04 ` Tom Linden
1998-01-03 12:46 Uncle George

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox