pause.c revision 204307
136270Swpaul/* 236270Swpaul * Copyright (c) 1983, 1993 336270Swpaul * The Regents of the University of California. All rights reserved. 436270Swpaul * 536270Swpaul * Redistribution and use in source and binary forms, with or without 636270Swpaul * modification, are permitted provided that the following conditions 736270Swpaul * are met: 836270Swpaul * 1. Redistributions of source code must retain the above copyright 936270Swpaul * notice, this list of conditions and the following disclaimer. 1036270Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1136270Swpaul * notice, this list of conditions and the following disclaimer in the 1236270Swpaul * documentation and/or other materials provided with the distribution. 1336270Swpaul * 4. Neither the name of the University nor the names of its contributors 1436270Swpaul * may be used to endorse or promote products derived from this software 1536270Swpaul * without specific prior written permission. 1636270Swpaul * 1736270Swpaul * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1836270Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1936270Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2036270Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2136270Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2236270Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2336270Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2436270Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2536270Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2636270Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2736270Swpaul * SUCH DAMAGE. 2836270Swpaul */ 2936270Swpaul 3036270Swpaul#if defined(LIBC_SCCS) && !defined(lint) 3136270Swpaulstatic char sccsid[] = "@(#)pause.c 8.1 (Berkeley) 6/4/93"; 3250462Swpaul#endif /* LIBC_SCCS and not lint */ 3336270Swpaul#include <sys/cdefs.h> 3436270Swpaul__FBSDID("$FreeBSD: head/lib/libc/gen/pause.c 204307 2010-02-25 13:51:11Z kib $"); 3536270Swpaul 3636270Swpaul#include "namespace.h" 3736270Swpaul#include <signal.h> 3836270Swpaul#include <unistd.h> 3936270Swpaul#include "un-namespace.h" 4036270Swpaul 4139583Swpaul/* 4236270Swpaul * Backwards compatible pause. 4336270Swpaul */ 4436270Swpaulint 4536270Swpaul__pause(void) 4639583Swpaul{ 4736270Swpaul sigset_t oset; 4836270Swpaul 4936270Swpaul if (_sigprocmask(SIG_BLOCK, NULL, &oset) == -1) 5036270Swpaul return (-1); 5136270Swpaul return (_sigsuspend(&oset)); 5236270Swpaul} 5336270Swpaul__weak_reference(__pause, pause); 5436270Swpaul__weak_reference(__pause, _pause); 5536270Swpaul