sigwait.c revision 212405
1212405Sdavidxu/*- 2212405Sdavidxu * Copyright (c) 2010 davidxu@freebsd.org 3212405Sdavidxu * 4212405Sdavidxu * Redistribution and use in source and binary forms, with or without 5212405Sdavidxu * modification, are permitted provided that the following conditions 6212405Sdavidxu * are met: 7212405Sdavidxu * 1. Redistributions of source code must retain the above copyright 8212405Sdavidxu * notice, this list of conditions and the following disclaimer. 9212405Sdavidxu * 2. Redistributions in binary form must reproduce the above copyright 10212405Sdavidxu * notice, this list of conditions and the following disclaimer in the 11212405Sdavidxu * documentation and/or other materials provided with the distribution. 12212405Sdavidxu * 13212405Sdavidxu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14212405Sdavidxu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15212405Sdavidxu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16212405Sdavidxu * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17212405Sdavidxu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18212405Sdavidxu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19212405Sdavidxu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20212405Sdavidxu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21212405Sdavidxu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22212405Sdavidxu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23212405Sdavidxu * SUCH DAMAGE. 24212405Sdavidxu */ 25212405Sdavidxu 26212405Sdavidxu#include <sys/cdefs.h> 27212405Sdavidxu__FBSDID("$FreeBSD: head/lib/libc/sys/sigwait.c 212405 2010-09-10 01:47:37Z davidxu $"); 28212405Sdavidxu 29212405Sdavidxu#include <errno.h> 30212405Sdavidxu#include <signal.h> 31212405Sdavidxu 32212405Sdavidxuint __sys_sigwait(const sigset_t * restrict, int * restrict); 33212405Sdavidxu 34212405Sdavidxu__weak_reference(__sigwait, sigwait); 35212405Sdavidxu 36212405Sdavidxuint 37212405Sdavidxu__sigwait(const sigset_t * restrict set, int * restrict sig) 38212405Sdavidxu{ 39212405Sdavidxu int ret; 40212405Sdavidxu 41212405Sdavidxu /* POSIX does not allow EINTR to be returned */ 42212405Sdavidxu do { 43212405Sdavidxu ret = __sys_sigwait(set, sig); 44212405Sdavidxu } while (ret == EINTR); 45212405Sdavidxu return (ret); 46212405Sdavidxu} 47