summaryrefslogblamecommitdiffstats
path: root/cpukit/posix/src/sigwait.c
blob: 121c74f3f30a352e07a4d76f89cc6cb7f6db3078 (plain) (tree)
1
2
3
4
5
6
7
8
9

        
  
                                       
                    


   
                            
                                                    


                                                           
                                         

   


                   
 
                   


                   
            

                                  













                                           
/**
 * @file
 *
 * @brief Synchronously Accept a Signal
 * @ingroup POSIXAPI
 */

/*
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#if HAVE_CONFIG_H
#include "config.h"
#endif

#include <stddef.h>
#include <signal.h>
#include <errno.h>

int sigwait(
  const sigset_t  *__restrict set,
  int             *__restrict sig
)
{
  int status;

  status = sigtimedwait( set, NULL, NULL );

  if ( status != -1 ) {
    if ( sig )
      *sig = status;
    return 0;
  }

  return errno;
}