2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2014-08-08 22:21:48 +02:00
|
|
|
* sched/pthread/pthread_sigmask.c
|
2007-03-24 00:22:22 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01: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-03-24 00:22:22 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-03-24 00:22:22 +01:00
|
|
|
*
|
2021-02-08 16:33:58 +01: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-03-24 00:22:22 +01:00
|
|
|
*
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-03-24 00:22:22 +01:00
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2007-03-24 00:22:22 +01:00
|
|
|
* Included Files
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2009-12-14 19:39:29 +01:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2007-03-24 00:22:22 +01:00
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2017-10-08 16:13:47 +02:00
|
|
|
#include <nuttx/signal.h>
|
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2007-03-24 00:22:22 +01:00
|
|
|
* Public Functions
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-03-24 00:22:22 +01:00
|
|
|
|
2015-10-03 01:43:18 +02:00
|
|
|
/****************************************************************************
|
2012-07-14 21:30:31 +02:00
|
|
|
* Name: pthread_sigmask
|
2007-03-24 00:22:22 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2017-10-07 20:16:10 +02:00
|
|
|
* This function is a simple wrapper around nxsig_procmask().
|
|
|
|
* See the nxsig_procmask() function description for further
|
2007-03-24 00:22:22 +01:00
|
|
|
* information.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2020-10-17 00:16:23 +02:00
|
|
|
* how - How the signal mask will be changed:
|
2007-03-24 00:22:22 +01:00
|
|
|
* SIG_BLOCK - The resulting set is the union of
|
|
|
|
* the current set and the signal set
|
|
|
|
* pointed to by 'set'.
|
|
|
|
* SIG_UNBLOCK - The resulting set is the intersection
|
|
|
|
* of the current set and the complement
|
|
|
|
* of the signal set pointed to by 'set'.
|
|
|
|
* SIG_SETMASK - The resulting set is the signal set
|
|
|
|
* pointed to by 'set'.
|
|
|
|
* set - Location of the new signal mask
|
|
|
|
* oset - Location to store the old signal mask
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-10-07 20:16:10 +02:00
|
|
|
* On success, this function will return 0 (OK). It will return EINVAL if
|
|
|
|
* how is invalid.
|
2007-03-24 00:22:22 +01:00
|
|
|
*
|
2015-10-03 01:43:18 +02:00
|
|
|
****************************************************************************/
|
2007-03-24 00:22:22 +01:00
|
|
|
|
|
|
|
int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
|
|
|
|
{
|
2023-07-03 10:27:59 +02:00
|
|
|
sigset_t nset;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* SIGKILL and SIGSTOP should not be added to signal mask */
|
|
|
|
|
|
|
|
if (set != NULL)
|
|
|
|
{
|
|
|
|
nset = *set;
|
|
|
|
nxsig_delset(&nset, SIGKILL);
|
|
|
|
nxsig_delset(&nset, SIGSTOP);
|
|
|
|
set = &nset;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = nxsig_procmask(how, set, oset);
|
2017-10-07 20:16:10 +02:00
|
|
|
return ret < 0 ? -ret : OK;
|
2007-03-24 00:22:22 +01:00
|
|
|
}
|