Port-macppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

SA_RESETHAND seems broken (in 5.x at least)



Hello,

Can anyone running NetBSD current on a macppc please try the following
code snippet?  Just build it, run the program and terminate it with
ctrl+c.

What happens?  In my case with netbsd-5, I get a segmentation fault.
This is just a test case for a problem I'm trying to diagnose with
other tools such as monotone, which get stuck chewing 100% cpu when
they receive one of the signals they are trapping.

AFAICT, the code is correct (both write and raise are signal safe) and
it works in amd64 current and some linux box.  Removing the
SA_RESETHAND makes the signal handler work.

Thanks!

-----
#include <signal.h>
#include <unistd.h>

static void
handler(int signo)
{
    write(2, "foo\n", 4);
    raise(signo);
}

int
main(void)
{
    struct sigaction sa;

    sa.sa_flags = SA_RESETHAND;
    sa.sa_handler = &handler;
    sigemptyset(&sa.sa_mask);

    sigaction(SIGINT, &sa, NULL);
    for (;;) {
        sleep(1);
    }
}
-----

-- 
Julio Merino


Home | Main Index | Thread Index | Old Index