2008-02-01 01:59:22 +08:00
|
|
|
/****************************************************************************
|
2014-08-09 02:55:02 +08:00
|
|
|
* sched/signal/sig_waitinfo.c
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2008-02-01 01:59:22 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2008-02-01 01:59:22 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Included Files
|
2008-02-01 01:59:22 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2009-12-15 02:39:29 +08:00
|
|
|
#include <nuttx/config.h>
|
2016-12-10 06:50:34 +08:00
|
|
|
|
2017-10-06 22:28:20 +08:00
|
|
|
#include <errno.h>
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2016-12-10 23:08:26 +08:00
|
|
|
#include <nuttx/cancelpt.h>
|
2017-10-06 22:28:20 +08:00
|
|
|
#include <nuttx/signal.h>
|
2016-12-10 06:50:34 +08:00
|
|
|
|
2008-02-01 01:59:22 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Public Functions
|
2008-02-01 01:59:22 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2008-02-01 01:59:22 +08:00
|
|
|
/****************************************************************************
|
2012-07-15 03:30:31 +08:00
|
|
|
* Name: sigwaitinfo
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
|
|
|
* Description:
|
2008-02-01 01:59:22 +08:00
|
|
|
* This function is equivalent to sigtimedwait with a NULL timeout
|
|
|
|
* parameter.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2018-03-13 23:52:27 +08:00
|
|
|
* Input Parameters:
|
2007-02-18 07:21:28 +08:00
|
|
|
* set - The pending signal set
|
|
|
|
* info - The returned value
|
|
|
|
*
|
2018-02-02 00:00:02 +08:00
|
|
|
* Returned Value:
|
2008-02-01 01:59:22 +08:00
|
|
|
* Signal number that cause the wait to be terminated, otherwise -1 (ERROR)
|
2017-10-06 22:28:20 +08:00
|
|
|
* is returned and the errno variable is set appropriately.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2008-02-01 01:59:22 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2008-02-01 01:59:22 +08:00
|
|
|
int sigwaitinfo(FAR const sigset_t *set, FAR struct siginfo *info)
|
2007-02-18 07:21:28 +08:00
|
|
|
{
|
2016-12-10 06:50:34 +08:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* sigwaitinfo() is a cancellation point */
|
|
|
|
|
2020-01-03 00:49:34 +08:00
|
|
|
enter_cancellation_point();
|
2016-12-10 06:50:34 +08:00
|
|
|
|
2017-10-06 22:28:20 +08:00
|
|
|
/* Just a wrapper around nxsig_timedwait() */
|
|
|
|
|
|
|
|
ret = nxsig_timedwait(set, info, NULL);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
set_errno(-ret);
|
|
|
|
ret = ERROR;
|
|
|
|
}
|
2016-12-10 06:50:34 +08:00
|
|
|
|
|
|
|
leave_cancellation_point();
|
|
|
|
return ret;
|
2007-02-18 07:21:28 +08:00
|
|
|
}
|