Add sigaltstack() prototype - Round 2
Joel Sherrill
joel.sherrill@oarcorp.com
Fri Aug 15 14:21:00 GMT 2014
On 8/15/2014 8:46 AM, Corinna Vinschen wrote:
> Hi Joel,
>
> On Aug 15 08:26, Joel Sherrill wrote:
>> Hi
>>
>> The RTEMS Project has been porting more and more FreeBSD code
>> for capabilities like IPV6, USB, and user level commands. We are
>> trying very hard not to have to modify the source code as we
>> move it over. Some of the kernel code we have brought over
>> resulted in this needing to be added.
>>
>> I first proposed v1 of this patch 2 years ago and dropped it.
>> I attempted address those comments though. See the other
>> recent thread.
>>
>> This method is defined here:
>>
>> http://pubs.opengroup.org/onlinepubs/009695399/functions/sigaltstack.html
>>
>> One odd thing is that newlib uses <sys/signal.h> for <signal.h> prototypes
>> so I followed the pattern. Not much really to the patch. It adds:
>>
>> + typedef struct sigaltstack {...} stack_t
>> + sigaltstack() prototype protected
>>
>> The big question (as always) is whether or not the guards on the methods
>> are correct.
>>
>> 2014-08-15 Joel Sherrill <...>
>>
>> * libc/include/sys/signal.h: Add sigaltstack() support.
> Shouldn't this patch define the available flags, too?
You are correct. It should. Obviously the code we were compiling didn't
use them. :)
Attached is v3. Values follow those in glibc. Same ChangeLog.
Built sparc-rtems
>
> Corinna
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
-------------- next part --------------
Index: newlib/libc/include/sys/signal.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/signal.h,v
retrieving revision 1.22
diff -u -r1.22 signal.h
--- newlib/libc/include/sys/signal.h 26 Oct 2012 09:23:46 -0000 1.22
+++ newlib/libc/include/sys/signal.h 15 Aug 2014 14:20:10 -0000
@@ -104,6 +104,23 @@
#define sa_sigaction _signal_handlers._sigaction
#endif
+#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
+/*
+ * Possible values for ss_flags in stack_t below.
+ */
+#define SS_ONSTACK 0x1
+#define SS_ONSTACK 0x2
+
+/*
+ * Structure used in sigaltstack call.
+ */
+typedef struct sigaltstack {
+ void *ss_sp; /* Stack base or pointer. */
+ int ss_flags; /* Flags. */
+ size_t ss_size; /* Stack size. */
+} stack_t;
+#endif
+
#elif defined(__CYGWIN__)
#include <cygwin/signal.h>
#else
@@ -161,6 +178,11 @@
int _EXFUN(sigsuspend, (const sigset_t *));
int _EXFUN(sigpause, (int));
+
+#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
+int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict));
+#endif
+
#if defined(_POSIX_THREADS)
#ifdef __CYGWIN__
# ifndef _CYGWIN_TYPES_H
More information about the Newlib
mailing list