1 | /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. All rights reserved. |
---|
2 | |
---|
3 | Redistribution and use in source and binary forms, with or without |
---|
4 | modification, are permitted provided that the following conditions |
---|
5 | are met: |
---|
6 | 1. Redistributions of source code must retain the above copyright |
---|
7 | notice, this list of conditions and the following disclaimer. |
---|
8 | 2. Redistributions in binary form must reproduce the above copyright |
---|
9 | notice, this list of conditions and the following disclaimer in the |
---|
10 | documentation and/or other materials provided with the distribution. |
---|
11 | 3. The name of the company may not be used to endorse or promote |
---|
12 | products derived from this software without specific prior written |
---|
13 | permission. |
---|
14 | |
---|
15 | THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
17 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
---|
18 | IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
---|
20 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
21 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
22 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
23 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
---|
25 | |
---|
26 | #include <_ansi.h> |
---|
27 | #include <signal.h> |
---|
28 | #include <errno.h> |
---|
29 | #include "svc.h" |
---|
30 | |
---|
31 | int _kill (int, int); |
---|
32 | |
---|
33 | int |
---|
34 | _kill (int pid, int sig) |
---|
35 | { |
---|
36 | param_block_t block[2]; |
---|
37 | |
---|
38 | if (pid == 0) |
---|
39 | return 0; |
---|
40 | if (pid != 1 && pid != -1) |
---|
41 | { |
---|
42 | errno = ESRCH; |
---|
43 | return -1; |
---|
44 | } |
---|
45 | |
---|
46 | block[0] = ADP_Stopped_RunTimeError; |
---|
47 | block[1] = sig; |
---|
48 | |
---|
49 | #if SEMIHOST_V2 |
---|
50 | if (_has_ext_exit_extended ()) |
---|
51 | return do_AngelSVC (AngelSVC_Reason_ReportExceptionExtended, block); |
---|
52 | else |
---|
53 | #endif |
---|
54 | return do_AngelSVC (AngelSVC_Reason_ReportException, block); |
---|
55 | } |
---|