source: trunk/libs/newlib/src/newlib/libc/reent/signalr.c

Last change on this file was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.6 KB
Line 
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
20int _dummy_link_syscalls = 1;
21
22#else
23
24/* We use the errno variable used by the system dependent layer.  */
25#undef errno
26extern int errno;
27
28/*
29FUNCTION
30        <<_kill_r>>---Reentrant version of kill
31       
32INDEX
33        _kill_r
34
35SYNOPSIS
36        #include <reent.h>
37        int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>);
38
39DESCRIPTION
40        This is a reentrant version of <<kill>>.  It
41        takes a pointer to the global data block, which holds
42        <<errno>>.
43*/
44
45int
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/*
59NEWPAGE
60FUNCTION
61        <<_getpid_r>>---Reentrant version of getpid
62       
63INDEX
64        _getpid_r
65
66SYNOPSIS
67        #include <reent.h>
68        int _getpid_r(struct _reent *<[ptr]>);
69
70DESCRIPTION
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
79int
80_getpid_r (struct _reent *ptr)
81{
82  int ret;
83  ret = _getpid ();
84  return ret;
85}
86
87#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
Note: See TracBrowser for help on using the repository browser.