Skip to content

Commit 67dd5d2

Browse files
committed
cu: make the cu tool can work with SIGNAL disabled
The core functionality of the cu tool does not rely on signal features. Therefore, we can isolate the signal-related implementations to ensure that most functions of the cu tool remain operational even when signals are disabled. Signed-off-by: guoshichao <[email protected]>
1 parent 744eed5 commit 67dd5d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

system/cu/cu_main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ static FAR void *cu_listener(FAR void *parameter)
153153
return NULL;
154154
}
155155

156+
#ifndef CONFIG_DISABLE_SIGNALS
156157
static void cu_exit(int signo, FAR siginfo_t *siginfo, FAR void *context)
157158
{
158159
FAR struct cu_globals_s *cu = siginfo->si_user;
159160
cu->force_exit = true;
160161
}
162+
#endif
161163

162164
#ifdef CONFIG_SERIAL_TERMIOS
163165
static int set_termios(FAR struct cu_globals_s *cu, int rate,
@@ -305,7 +307,9 @@ static int cu_cmd(FAR struct cu_globals_s *cu, char bcmd)
305307
int main(int argc, FAR char *argv[])
306308
{
307309
pthread_attr_t attr;
310+
#ifndef CONFIG_DISABLE_SIGNALS
308311
struct sigaction sa;
312+
#endif
309313
struct cu_globals_s cu;
310314
FAR const char *devname = CONFIG_SYSTEM_CUTERM_DEFAULT_DEVICE;
311315
#ifdef CONFIG_SERIAL_TERMIOS
@@ -325,6 +329,7 @@ int main(int argc, FAR char *argv[])
325329
memset(&cu, 0, sizeof(struct cu_globals_s));
326330
cu.escape = '~';
327331

332+
#ifndef CONFIG_DISABLE_SIGNALS
328333
/* Install signal handlers */
329334

330335
memset(&sa, 0, sizeof(sa));
@@ -337,6 +342,7 @@ int main(int argc, FAR char *argv[])
337342
errno);
338343
return EXIT_FAILURE;
339344
}
345+
#endif
340346

341347
optind = 0; /* Global that needs to be reset in FLAT mode */
342348
while ((option = getopt(argc, argv, "l:s:ceE:fho?")) != ERROR)

0 commit comments

Comments
 (0)