Skip to content

Commit c05d9df

Browse files
authored
Merge pull request #3276 from BernardXiong/fix_signal_minilibc
[Kernel] Fix the signal compiling issue when using minilibc
2 parents a87c2ef + b5e4aa5 commit c05d9df

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2017-09-12 Bernard The first version
9+
*/
10+
11+
#ifndef SIGNAL_H__
12+
#define SIGNAL_H__
13+
14+
#include <libc/libc_signal.h>
15+
16+
#define SIG_DFL ((_sig_func_ptr)0) /* Default action */
17+
#define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */
18+
#define SIG_ERR ((_sig_func_ptr)-1) /* Error return */
19+
20+
#endif

include/libc/libc_signal.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,14 @@ typedef struct siginfo siginfo_t;
6363
#define SI_MESGQ 0x05 /* Signal generated by arrival of a
6464
message on an empty message queue. */
6565

66-
#ifdef RT_USING_NEWLIB
67-
#include <sys/signal.h>
66+
#if !defined(RT_USING_NEWLIB)
67+
typedef void (*_sig_func_ptr)(int);
68+
typedef unsigned long sigset_t;
6869
#endif
6970

70-
#if defined(__CC_ARM) || defined(__CLANG_ARM)
7171
#include <signal.h>
72-
typedef unsigned long sigset_t;
72+
73+
#if defined(__CC_ARM) || defined(__CLANG_ARM)
7374

7475
#define SIGHUP 1
7576
/* #define SIGINT 2 */
@@ -105,8 +106,6 @@ typedef unsigned long sigset_t;
105106
#define SIG_BLOCK 1 /* set of signals to block */
106107
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
107108

108-
typedef void (*_sig_func_ptr)(int);
109-
110109
struct sigaction
111110
{
112111
_sig_func_ptr sa_handler;
@@ -124,8 +123,6 @@ int sigprocmask (int how, const sigset_t *set, sigset_t *oset);
124123
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
125124

126125
#elif defined(__IAR_SYSTEMS_ICC__)
127-
#include <signal.h>
128-
typedef unsigned long sigset_t;
129126

130127
#define SIGHUP 1
131128
#define SIGINT 2
@@ -161,8 +158,6 @@ typedef unsigned long sigset_t;
161158
#define SIG_BLOCK 1 /* set of signals to block */
162159
#define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
163160

164-
typedef void (*_sig_func_ptr)(int);
165-
166161
struct sigaction
167162
{
168163
_sig_func_ptr sa_handler;

0 commit comments

Comments
 (0)