1 | /* Reentrant versions of syscalls need to support signal/raise. |
---|
2 | These implementations just call the usual system calls. */ |
---|
3 | |
---|
4 | #include <reent.h> |
---|
5 | #include <signal.h> |
---|
6 | #include <unistd.h> |
---|
7 | #include <_syslist.h> |
---|
8 | |
---|
9 | /* Some targets provides their own versions of these functions. Those |
---|
10 | targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
---|
11 | |
---|
12 | #ifdef _REENT_ONLY |
---|
13 | #ifndef REENTRANT_SYSCALLS_PROVIDED |
---|
14 | #define REENTRANT_SYSCALLS_PROVIDED |
---|
15 | #endif |
---|
16 | #endif |
---|
17 | |
---|
18 | #ifdef REENTRANT_SYSCALLS_PROVIDED |
---|
19 | |
---|
20 | int _dummy_link_syscalls = 1; |
---|
21 | |
---|
22 | #else |
---|
23 | |
---|
24 | /* We use the errno variable used by the system dependent layer. */ |
---|
25 | #undef errno |
---|
26 | extern int errno; |
---|
27 | |
---|
28 | /* |
---|
29 | FUNCTION |
---|
30 | <<_kill_r>>---Reentrant version of kill |
---|
31 | |
---|
32 | INDEX |
---|
33 | _kill_r |
---|
34 | |
---|
35 | SYNOPSIS |
---|
36 | #include <reent.h> |
---|
37 | int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>); |
---|
38 | |
---|
39 | DESCRIPTION |
---|
40 | This is a reentrant version of <<kill>>. It |
---|
41 | takes a pointer to the global data block, which holds |
---|
42 | <<errno>>. |
---|
43 | */ |
---|
44 | |
---|
45 | int |
---|
46 | _kill_r (struct _reent *ptr, |
---|
47 | int pid, |
---|
48 | int sig) |
---|
49 | { |
---|
50 | int ret; |
---|
51 | |
---|
52 | errno = 0; |
---|
53 | if ((ret = _kill (pid, sig)) == -1 && errno != 0) |
---|
54 | ptr->_errno = errno; |
---|
55 | return ret; |
---|
56 | } |
---|
57 | |
---|
58 | /* |
---|
59 | NEWPAGE |
---|
60 | FUNCTION |
---|
61 | <<_getpid_r>>---Reentrant version of getpid |
---|
62 | |
---|
63 | INDEX |
---|
64 | _getpid_r |
---|
65 | |
---|
66 | SYNOPSIS |
---|
67 | #include <reent.h> |
---|
68 | int _getpid_r(struct _reent *<[ptr]>); |
---|
69 | |
---|
70 | DESCRIPTION |
---|
71 | This is a reentrant version of <<getpid>>. It |
---|
72 | takes a pointer to the global data block, which holds |
---|
73 | <<errno>>. |
---|
74 | |
---|
75 | We never need <<errno>>, of course, but for consistency we |
---|
76 | still must have the reentrant pointer argument. |
---|
77 | */ |
---|
78 | |
---|
79 | int |
---|
80 | _getpid_r (struct _reent *ptr) |
---|
81 | { |
---|
82 | int ret; |
---|
83 | ret = _getpid (); |
---|
84 | return ret; |
---|
85 | } |
---|
86 | |
---|
87 | #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
---|