source: trunk/src/emx/src/lib/process/sigaltstack.c@ 1617

Last change on this file since 1617 was 1617, checked in by bird, 21 years ago

Debugging signals.

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: sigaltstack.c 1617 2004-11-07 09:33:03Z bird $ */
2/** @file
3 *
4 * LIBC - sigaltstack().
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* Header Files *
29*******************************************************************************/
30#include "libc-alias.h"
31#include <signal.h>
32#include <errno.h>
33#include <InnoTekLIBC/thread.h>
34#include <InnoTekLIBC/backend.h>
35#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_SIGNAL
36#include <InnoTekLIBC/logstrict.h>
37
38
39
40/**
41 * Changes and/or queries the alternative signal stack
42 * settings of the current thread.
43 *
44 * @returns 0 on success.
45 * @returns Negative error number (errno.h) on failure.
46 * @param pThrd Thread which signal stack to change and/or query.
47 * @param pStack New stack settings. (Optional)
48 * @param pOldStack Old stack settings. (Optional)
49 */
50int _STD(sigaltstack)(const stack_t *pStack, stack_t *pOldStack)
51{
52 LIBCLOG_ENTER("pStack=%p {ss_flags=%#x, ss_sp=%p, ss_size=%d} pOldStack=%p\n",
53 (void *)pStack,
54 pStack ? pStack->ss_flags : 0,
55 pStack ? pStack->ss_sp : NULL,
56 pStack ? pStack->ss_size : 0,
57 (void *)pOldStack);
58
59 /*
60 * Perform operation and return.
61 */
62 stack_t OldStack;
63 int rc = __libc_Back_signalStack(__libc_threadCurrent(), pStack, &OldStack);
64 if (!rc)
65 {
66 if (pOldStack)
67 *pOldStack = OldStack;
68 LIBCLOG_RETURN_MSG(0, "ret 0 (*pOldStack {ss_flags=%#x, ss_sp=%p, ss_size=%d}\n",
69 OldStack.ss_flags, OldStack.ss_sp, OldStack.ss_size);
70 }
71
72 errno = -rc;
73 LIBCLOG_RETURN_INT(-1);
74}
75
Note: See TracBrowser for help on using the repository browser.