Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / signalr.c
blob863ae74005767c910cc484937c2b1a8fb067c478
1 /* Reentrant versions of syscalls need to support signal/raise.
2 These implementations just call the usual system calls. */
4 #include <reent.h>
5 #include <signal.h>
6 #include <unistd.h>
7 #include <_syslist.h>
9 /* Some targets provides their own versions of these functions. Those
10 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
12 #ifdef _REENT_ONLY
13 #ifndef REENTRANT_SYSCALLS_PROVIDED
14 #define REENTRANT_SYSCALLS_PROVIDED
15 #endif
16 #endif
18 #ifdef REENTRANT_SYSCALLS_PROVIDED
20 int _dummy_link_syscalls = 1;
22 #else
24 /* We use the errno variable used by the system dependent layer. */
25 #undef errno
26 extern int errno;
29 FUNCTION
30 <<_kill_r>>---Reentrant version of kill
32 INDEX
33 _kill_r
35 SYNOPSIS
36 #include <reent.h>
37 int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>);
39 DESCRIPTION
40 This is a reentrant version of <<kill>>. It
41 takes a pointer to the global data block, which holds
42 <<errno>>.
45 int
46 _kill_r (struct _reent *ptr,
47 int pid,
48 int sig)
50 int ret;
52 errno = 0;
53 if ((ret = _kill (pid, sig)) == -1 && errno != 0)
54 _REENT_ERRNO(ptr) = errno;
55 return ret;
59 NEWPAGE
60 FUNCTION
61 <<_getpid_r>>---Reentrant version of getpid
63 INDEX
64 _getpid_r
66 SYNOPSIS
67 #include <reent.h>
68 int _getpid_r(struct _reent *<[ptr]>);
70 DESCRIPTION
71 This is a reentrant version of <<getpid>>. It
72 takes a pointer to the global data block, which holds
73 <<errno>>.
75 We never need <<errno>>, of course, but for consistency we
76 still must have the reentrant pointer argument.
79 int
80 _getpid_r (struct _reent *ptr)
82 int ret;
83 ret = _getpid ();
84 return ret;
87 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */