public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO
@ 2008-07-14 17:16 who at connect dot carleton dot ca
  2008-07-14 17:29 ` [Bug manual/6745] " who at connect dot carleton dot ca
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: who at connect dot carleton dot ca @ 2008-07-14 17:16 UTC (permalink / raw)
  To: glibc-bugs

I'm trying to write a server application that will wait for incoming connections.

Whenever a client attempts to connect/read/write (basically when the socket
experiences activity) a signal is supposed to be triggered.

I used:
fcntl(socket, F_SETSIG, SIGIO);
fcntl(socket, F_SETFL, O_ASYNC | O_NONBLOCK);
fcntl(socket, F_SETOWN, getpid());

And:
struct sigaction action;
action.sa_sigaction = &MySigHandler;
action.sa_flags = SA_SIGINFO;
sigaction(SIGIO, &action, NULL);

According to the man pages, whenever there is activity in the socket "socket", a
signal will be raised. The signal would be handled by "MySigHandler", and since
the "SA_SIGINFO" flag was set, the signal would provide additional information
to the function. And here is when the unexpected behaviour occurs.

According to the manpages, the second parameter of the handler (siginfo_t *)
should contain additional information. Among the information, si_code is
supposed to have "SI_SIGIO" if the signal was generated by a queued SIGIO.

Instead of having SI_SIGIO (supposed to be -5) I get a value of 1. I also tried
"kill -s SIGIO <pid of server>" and got a value of 0 (SI_USER), which is the
expected value when the signal is raised by kill.

I'm currently using glib version 2.7-2 on Linux version 2.6.23.1-42.fc8.

To reproduce the problem simply setup a socket using fcntl (as above), make it
listen for incoming connections, and use sigaction (as above) to make a function
handle the signal. Inside the function, print out the contents of si_code. If
necessary, I can provide my own code.

-- 
           Summary: si_code != SI_SIGIO when a signal is generated by queued
                    SIGIO
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: manual
        AssignedTo: roland at gnu dot org
        ReportedBy: who at connect dot carleton dot ca
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
  2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
@ 2008-07-14 17:29 ` who at connect dot carleton dot ca
  2008-07-14 17:29 ` who at connect dot carleton dot ca
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: who at connect dot carleton dot ca @ 2008-07-14 17:29 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From who at connect dot carleton dot ca  2008-07-14 17:29 -------
Created an attachment (id=2828)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2828&action=view)
client code to see the problem


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
  2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
  2008-07-14 17:29 ` [Bug manual/6745] " who at connect dot carleton dot ca
@ 2008-07-14 17:29 ` who at connect dot carleton dot ca
  2008-07-14 17:33 ` who at connect dot carleton dot ca
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: who at connect dot carleton dot ca @ 2008-07-14 17:29 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From who at connect dot carleton dot ca  2008-07-14 17:28 -------
Created an attachment (id=2827)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2827&action=view)
server code to see the problem


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
  2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
  2008-07-14 17:29 ` [Bug manual/6745] " who at connect dot carleton dot ca
  2008-07-14 17:29 ` who at connect dot carleton dot ca
@ 2008-07-14 17:33 ` who at connect dot carleton dot ca
  2008-07-15  7:00 ` halesh dot s at india dot com
  2008-07-15 14:57 ` who at connect dot carleton dot ca
  4 siblings, 0 replies; 7+ messages in thread
From: who at connect dot carleton dot ca @ 2008-07-14 17:33 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From who at connect dot carleton dot ca  2008-07-14 17:32 -------
I have added source code to reproduce the problem.

The server will never exit until killed by SIGTERM (or SIGKILL and SIGSTOP).

The client will just attempt to connect (to trigger the SIGIO signal) and then
will exit.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
  2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
                   ` (2 preceding siblings ...)
  2008-07-14 17:33 ` who at connect dot carleton dot ca
@ 2008-07-15  7:00 ` halesh dot s at india dot com
  2008-07-15 14:57 ` who at connect dot carleton dot ca
  4 siblings, 0 replies; 7+ messages in thread
From: halesh dot s at india dot com @ 2008-07-15  7:00 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From halesh dot s at india dot com  2008-07-15 07:00 -------

Check this discussion, may be helpful

http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg03633.html

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
  2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
                   ` (3 preceding siblings ...)
  2008-07-15  7:00 ` halesh dot s at india dot com
@ 2008-07-15 14:57 ` who at connect dot carleton dot ca
  4 siblings, 0 replies; 7+ messages in thread
From: who at connect dot carleton dot ca @ 2008-07-15 14:57 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From who at connect dot carleton dot ca  2008-07-15 14:56 -------
Thanks for the info.

Apparently it's been known since 2000 that si_code does not contain SI_SIGIO
(like the man pages say) anymore.

Looks like it will stay that way for a while now, so I'll just avoid using
si_code for now.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6745

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug manual/6745] si_code != SI_SIGIO when a signal is generated by queued SIGIO
       [not found] <bug-6745-131@http.sourceware.org/bugzilla/>
@ 2012-04-08 13:09 ` aj at suse dot de
  0 siblings, 0 replies; 7+ messages in thread
From: aj at suse dot de @ 2012-04-08 13:09 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=6745

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |aj at suse dot de
         Resolution|                            |INVALID

--- Comment #6 from Andreas Jaeger <aj at suse dot de> 2012-04-08 13:08:56 UTC ---
This is a bug in the manpages, I've brought this bug to the attention of the
Linux man page maintainer.

Closing as INVALID since it's not a bug in the documentation that is part of
glibc.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

end of thread, other threads:[~2012-04-08 13:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-14 17:16 [Bug manual/6745] New: si_code != SI_SIGIO when a signal is generated by queued SIGIO who at connect dot carleton dot ca
2008-07-14 17:29 ` [Bug manual/6745] " who at connect dot carleton dot ca
2008-07-14 17:29 ` who at connect dot carleton dot ca
2008-07-14 17:33 ` who at connect dot carleton dot ca
2008-07-15  7:00 ` halesh dot s at india dot com
2008-07-15 14:57 ` who at connect dot carleton dot ca
     [not found] <bug-6745-131@http.sourceware.org/bugzilla/>
2012-04-08 13:09 ` aj at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).