Re: buffering SIGIO instances

From: Michael Kerrisk (michael.kerrisk.at.gmx.net_at_nospam.com)
Date: 06/29/05


Date: Wed, 29 Jun 2005 10:08:37 +0200

On 28 Jun 2005 08:08:01 -0700, loic-dev@gmx.net wrote:

>Salut Madhav,
>
>> I am using the signal based model for reading data from a
>> socket.
>> That is, i am using fcntl() to raise a SIGIO whenever there is data to
>> be read from that socket. I want to know if i get many instances of
>> SIGIO ( ie could be raised by calling write() multiple times on the
>> socket descriptor ) are they buffered by default?
>
>I am not an expert in that area, but AFAIK (on Linux) only real-time
>signals are queued. SIGIO doesn't belong to that list.

Right.

>> If they are not buffered, Is there any way to put the
>> signal on hold and later process it when i am inside a signal handler?
>
>Yes, it seems so. Accordingly to the fcntl() man page, use F_SETSIG and
>instead of passing 0 (default: SIGIO), gives the signal you want. In
>your case, choose any signal number comprised between SIGRTMIN and
>SIGRTMAX.

Yes. Also, if Linux is your primary target, then it is worth getting
a recent copy of the manual pages (2.05) from
ftp://ftp.win.tue.nl/pub/linux-local/manpages/
and reading the fcntl(2) manual page to get information about various
useful (but non-portable) Linux-specific features for working with
signal-driven I/O.

Note also that there are limits on the number of real-time signals
that can be queued (things changed in Linux 2.6.7; see the signal(7)
and setrlimit(2) manual pages for details).

Having said all of this, you might want to consider using
select()/poll() or (the Linux-specific) epoll interface, since they
can be more convenient to work with than asynchronously delivered
signals.

Cheers,

Michael



Relevant Pages

  • Re: buffering SIGIO instances
    ... i am using fcntl() to raise a SIGIO whenever there is data to ... >> be read from that socket. ... Note also that there are limits on the number of real-time signals ...
    (comp.os.linux.development.apps)
  • Re: buffering SIGIO instances
    ... i am using fcntl() to raise a SIGIO whenever there is data to ... >> be read from that socket. ... Note also that there are limits on the number of real-time signals ...
    (comp.os.linux.development.system)
  • Re: buffering SIGIO instances
    ... i am using fcntl() to raise a SIGIO whenever there is data to ... > be read from that socket. ... signals are queued. ...
    (comp.os.linux.development.apps)
  • Re: buffering SIGIO instances
    ... i am using fcntl() to raise a SIGIO whenever there is data to ... > be read from that socket. ... signals are queued. ...
    (comp.os.linux.development.system)
  • Re: buffering SIGIO instances
    ... i am using fcntl() to raise a SIGIO whenever there is data to ... > be read from that socket. ... signals are queued. ...
    (comp.unix.programmer)