1b6543ee8SDavid Xu /*
2b6543ee8SDavid Xu * Copyright (c) 2005, David Xu <davidxu@viatech.com.cn>
3b6543ee8SDavid Xu *
4b6543ee8SDavid Xu * Redistribution and use in source and binary forms, with or without
5b6543ee8SDavid Xu * modification, are permitted provided that the following conditions
6b6543ee8SDavid Xu * are met:
7b6543ee8SDavid Xu * 1. Redistributions of source code must retain the above copyright
8b6543ee8SDavid Xu * notice, this list of conditions and the following disclaimer.
9b6543ee8SDavid Xu * 2. Redistributions in binary form must reproduce the above copyright
10b6543ee8SDavid Xu * notice, this list of conditions and the following disclaimer in the
11b6543ee8SDavid Xu * documentation and/or other materials provided with the distribution.
12b6543ee8SDavid Xu *
13b6543ee8SDavid Xu * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14b6543ee8SDavid Xu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15b6543ee8SDavid Xu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16b6543ee8SDavid Xu * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17b6543ee8SDavid Xu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18b6543ee8SDavid Xu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19b6543ee8SDavid Xu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20b6543ee8SDavid Xu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21b6543ee8SDavid Xu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22b6543ee8SDavid Xu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23b6543ee8SDavid Xu * SUCH DAMAGE.
24b6543ee8SDavid Xu */
25b6543ee8SDavid Xu
26b6543ee8SDavid Xu #include "namespace.h"
27b6543ee8SDavid Xu #include <signal.h>
28b6543ee8SDavid Xu #include <errno.h>
29b6543ee8SDavid Xu #include "un-namespace.h"
30b6543ee8SDavid Xu
31*a32e3ba6SSascha Wildner int _sigwait(const sigset_t *, int *);
32*a32e3ba6SSascha Wildner
33e2b7bcaeSSascha Wildner extern int __sys_sigwaitinfo(const sigset_t *, siginfo_t *);
34e2b7bcaeSSascha Wildner
35b6543ee8SDavid Xu int
_sigwait(const sigset_t * set,int * sig)36b6543ee8SDavid Xu _sigwait(const sigset_t *set, int *sig)
37b6543ee8SDavid Xu {
38b6543ee8SDavid Xu int s;
39b6543ee8SDavid Xu
40b6543ee8SDavid Xu s = __sys_sigwaitinfo(set, NULL);
41b6543ee8SDavid Xu if (s > 0) {
42b6543ee8SDavid Xu *sig = s;
43b6543ee8SDavid Xu return (0);
44b6543ee8SDavid Xu }
45b6543ee8SDavid Xu return (errno);
46b6543ee8SDavid Xu }
47f8406b33Szrj
48f8406b33Szrj __weak_reference(_sigwait, sigwait);
49