Bug 211372 - unhandled syscall: unix:330 (sigwait)
Summary: unhandled syscall: unix:330 (sigwait)
Status: CONFIRMED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.7 SVN
Platform: Compiled Sources macOS
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
: 258399 353346 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-10-21 21:36 UTC by Nahor
Modified: 2023-11-21 07:18 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nahor 2009-10-21 21:36:54 UTC
This simple app waits for the user to hit "Ctrl+C".

#include <signal.h>
#include <stdio.h>

int main() {
        sigset_t sigset;
        sigemptyset(&sigset);
        sigaddset(&sigset, SIGINT);

        sigprocmask(SIG_BLOCK, &sigset,NULL);

        int sig;
        int result = sigwait(&sigset, &sig);
        if (result != 0) {
                fprintf(stderr, "sigwait failed: %d\n", result);
        }

        return 0;
}

When run inside valgrind, sigwait returns immediately with error 78 (ENOSYS).
Comment 1 Julian Seward 2011-02-11 13:16:07 UTC
*** Bug 258399 has been marked as a duplicate of this bug. ***
Comment 2 Julian Seward 2011-02-11 13:25:44 UTC
Not sure I can easily fix this for 3.6.1.  Retargetting for 3.7.0.

Valgrind's signal handling implementation is tricky, and I don't
have confidence that I can make a quick fix that doesn't cause a
regression.  Fixing it properly will require writing a comprehensive
test program that exercises sigwait().  Providing a good one would
help accelerate a proper fix (hint, hint).
Comment 3 neumann 2012-03-09 10:22:33 UTC
Maybe the following test case can help: Under Mac OS X Lion, when downloading naviserver from bitbucket
https://bitbucket.org/naviserver/naviserver/overview
or sourceforge
http://sourceforge.net/projects/naviserver/files/naviserver/4.99.4/

and running after usual "configure,.... make...." sermon 
make memcheck
you will see the following output from valgrind. Notice that "ns_sigwait" is the signal handler implemented by naviserver.

09/Mar/2012:11:07:37][18848.30e960][-main-] Notice: nsmain: security info: uid=501, euid=501, gid=501, egid=501
--18848-- WARNING: unhandled syscall: unix:330
--18848-- You may be able to write your own handler.
--18848-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--18848-- Nevertheless we consider this a bug.  Please report
--18848-- it at http://valgrind.org/support/bug_reports.html.
[09/Mar/2012:11:07:37][18848.30e960][-main-] Fatal: signal: ns_sigwait failed: Function not implemented
[09/Mar/2012:11:07:37][18848.b028d000][-sched-] Notice: sched: starting
--18848:0:schedule VG_(sema_down): read returned -4
Comment 4 Nick Knize 2012-05-23 20:46:13 UTC
Any updates on this bug?
Comment 5 Mark Andrews 2013-09-03 07:47:42 UTC
If nothing else don't printout the warning message a million times a second.
One only needs to be told *once* that a system call is not supported.
Comment 6 Rhys Kidd 2015-10-02 05:31:12 UTC
*** Bug 353346 has been marked as a duplicate of this bug. ***
Comment 7 Paul Floyd 2023-11-21 07:18:35 UTC
I tried copying the FreeBSD implementation but the regtest that I added fails.

The sigwait part seems OK but it's the simple bit at the beginning that is just doing signal()/raise() that is failing.