- To: libc-gnats at gnu dot org, gnats-admin at gnu dot org
- Subject: libc/2381: on alpha, sigsuspend does not return -1 and set errno toEINTR
- From: Eric Branlund <eric at msg dot ucsf dot edu>
- Date: Mon, 09 Jul 2001 16:15:03 -0400
Note: There was a bad value `' for the field `Class'.
It was set to the default value of `sw-bug'.
Note: There was a bad value `' for the field `Priority'.
It was set to the default value of `medium'.
Note: There was a bad value `' for the field `Severity'.
It was set to the default value of `serious'.
>Number: 2381
>Category: libc
>Synopsis: On alpha, sigsuspend does not return -1 and set errno to EINTR.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: libc-gnats
>State: open
>Quarter:
>Keywords:
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Mon Jul 09 16:15:02 -0400 2001
>Cases:
>Originator: Eric Branlund
>Release: libc-2.1.3
>Organization:
>Environment:
ds10 with 600 MHz ev67 running RedHat 6.2
Host type: alpha-redhat-linux-gnu
System: Linux ds1032.msgnet 2.2.17 #1 Thu Feb 15 10:11:36 PST 2001 alpha
unknown
Architecture: alpha
Addons: c_stubs crypt glibc-compat linuxthreads
Build CFLAGS: -O3 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g
Build CC: egcs
Compiler version: egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Kernel headers: 2.2.14-6.0
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: no
Build bounded: no
Build static-nss: no
Stdio: libio
>Description:
An application installs a signal handler via sigaction and waits
for a signal with sigsuspend. When it receives a signal for which
it has a handler installed and sigsuspend returns, the return value
is not -1 and errno has not been set to EINTR.
>How-To-Repeat:
Assuming that the source code below is in test_suspend.c, then
these commands:
sh
gcc -Wall test_suspend.c
./a.out &
kill -USR1 $!
kill -INT $!
give this result:
sigsuspend returns 111 and errno = 0
on the system to which I have access.
--------------------------------------------------------------------------
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
static void handle_usr1(int sig);
int main(int argc, char* argv[])
{
sigset_t mask, old_mask;
struct sigaction sa;
if (sigemptyset(&mask) != 0 ||
sigaddset(&mask, SIGUSR1) != 0) {
perror("sigemptyset");
return EXIT_FAILURE;
}
if (sigemptyset(&sa.sa_mask) != 0) {
perror("sigemptyset");
return EXIT_FAILURE;
}
sa.sa_flags = 0;
sa.sa_handler = handle_usr1;
if (sigaction(SIGUSR1, &sa, (struct sigaction*) 0) != 0) {
perror("sigaction");
return EXIT_FAILURE;
}
if (sigprocmask(SIG_UNBLOCK, &mask, &old_mask) != 0) {
perror("sigprocmask");
return EXIT_FAILURE;
}
while (1) {
(void) printf("sigsuspend returns %d ", sigsuspend(&old_mask));
(void) printf("and errno = %d\n", errno);
}
}
static void handle_usr1(int sig) {}
>Fix: