exit vs. kill on ARM
Shaun Jackman
sjackman@gmail.com
Tue Jul 19 00:04:00 GMT 2005
ARM has only one SWI for both _exit and _kill. To give the SWI handler
(i.e. the kernel) a hope of differentiating the two calls, this patch
modifies _exit to call the SWI with the second argument set to -1,
which is an invalid value for signum. This does not affect the RDI
implementation, since it discards both its arguments anyways.
This patch also removes _raise. My grepping of the code has shown that
newlib calls _raise_r, which is implemented in
newlib/libc/signal/signal.c, but never _raise.
Cheers,
Shaun
2005-07-18 Shaun Jackman <sjackman@gmail.com>
* libgloss/arm/syscalls.c (_exit): Call _kill with the second
argument set to -1, which is an invalid signal number.
(_kill): Comment and coding style changes only.
(_raise): Remove function.
Index: libgloss/arm/syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/syscalls.c,v
retrieving revision 1.5
diff -u -r1.5 syscalls.c
--- libgloss/arm/syscalls.c 18 Jul 2005 16:18:17 -0000 1.5
+++ libgloss/arm/syscalls.c 18 Jul 2005 23:59:29 -0000
@@ -22,7 +22,6 @@
int _isatty _PARAMS ((int));
clock_t _times _PARAMS ((struct tms *));
int _gettimeofday _PARAMS ((struct timeval *, struct timezone *));
-int _raise _PARAMS ((int));
int _unlink _PARAMS ((const char *));
int _link _PARAMS ((void));
int _stat _PARAMS ((const char *, struct stat *));
@@ -434,30 +433,28 @@
return wrap (_swiclose (file));
}
-void
-_exit (int n)
-{
- /* FIXME: return code is thrown away. */
-
-#ifdef ARM_RDI_MONITOR
- do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_ApplicationExit);
-#else
- asm ("swi %a0" :: "i" (SWI_Exit));
-#endif
- n = n;
-}
-
int
-_kill (int n, int m)
+_kill (int pid, int sig)
{
+ (void)pid; (void)sig;
#ifdef ARM_RDI_MONITOR
+ /* Note: Both arguments are thrown away. */
return do_AngelSWI (AngelSWI_Reason_ReportException,
(void *) ADP_Stopped_ApplicationExit);
#else
asm ("swi %a0" :: "i" (SWI_Exit));
#endif
- n = n; m = m;
+}
+
+void
+_exit (int status)
+{
+ // There is only one SWI for both _exit and _kill. For _exit, call
+ // the SWI with the second argument set to -1, an invalid value for
+ // signum, so that the SWI handler can distinguish the two calls.
+ // Note: The RDI implementation of _kill throws away both its
+ // arguments.
+ _kill(status, -1);
}
int __attribute__((weak))
@@ -545,14 +542,6 @@
#endif
}
-int __attribute__((weak))
-_raise (int sig)
-{
- (void)sig;
- errno = ENOSYS;
- return -1;
-}
-
int
_gettimeofday (struct timeval * tp, struct timezone * tzp)
{
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libgloss-arm-kill.diff
URL: <http://sourceware.org/pipermail/newlib/attachments/20050719/a514a3af/attachment.ksh>
More information about the Newlib
mailing list