| 1 | /* $Id: sigignore.c 1614 2004-11-05 02:16:17Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * LIBC - sigignore().
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2004 knut st. osmundsen <[email protected]>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of InnoTek LIBC.
|
|---|
| 10 | *
|
|---|
| 11 | * InnoTek LIBC is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published
|
|---|
| 13 | * by the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * InnoTek LIBC is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | * GNU Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public License
|
|---|
| 22 | * along with InnoTek LIBC; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | /*******************************************************************************
|
|---|
| 29 | * Header Files *
|
|---|
| 30 | *******************************************************************************/
|
|---|
| 31 | #include "libc-alias.h"
|
|---|
| 32 | #include <signal.h>
|
|---|
| 33 | #include <errno.h>
|
|---|
| 34 | #include <InnoTekLIBC/signals.h>
|
|---|
| 35 | #include <InnoTekLIBC/thread.h>
|
|---|
| 36 | #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
|
|---|
| 37 | #include <InnoTekLIBC/logstrict.h>
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * Ignores the a signal (process wide).
|
|---|
| 43 | *
|
|---|
| 44 | * @returns 0 on success.
|
|---|
| 45 | * @returns -1 and errno set to EINVAL, if iSignalNo is invalid,
|
|---|
| 46 | * @param iSignalNo Signal to block.
|
|---|
| 47 | */
|
|---|
| 48 | int _STD(sigignore)(int iSignalNo)
|
|---|
| 49 | {
|
|---|
| 50 | LIBCLOG_ENTER("iSignalNo=%d\n", iSignalNo);
|
|---|
| 51 | struct sigaction SigAct;
|
|---|
| 52 | int rc;
|
|---|
| 53 |
|
|---|
| 54 | /*
|
|---|
| 55 | * Validate.
|
|---|
| 56 | */
|
|---|
| 57 | if (!__SIGSET_SIG_VALID(iSignalNo))
|
|---|
| 58 | {
|
|---|
| 59 | LIBC_ASSERTM_FAILED("Invalid signal no %d\n", iSignalNo);
|
|---|
| 60 | errno = EINVAL;
|
|---|
| 61 | LIBCLOG_RETURN_INT(-1);
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | /*
|
|---|
| 65 | * Forward to sigaction().
|
|---|
| 66 | */
|
|---|
| 67 | SigAct.__sigaction_u.__sa_handler = SIG_IGN;
|
|---|
| 68 | SigAct.sa_flags = 0;
|
|---|
| 69 | __SIGSET_EMPTY(&SigAct.sa_mask);
|
|---|
| 70 |
|
|---|
| 71 | rc = sigaction(iSignalNo, &SigAct, NULL);
|
|---|
| 72 |
|
|---|
| 73 | LIBCLOG_RETURN_INT(rc);
|
|---|
| 74 | }
|
|---|