Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Catch SIGTERM in addition to SIGINT
SIGINT catches CTRL-C. However, if a user will just terminate the em100 utility by running killall without any signal argument, e.g. $ killall em100 The utility will not leave the em100 utility in a good state and and it will stop working on consecutive calls. Hence catch SIGTERM as well, to make calls killall calls non-lethal.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I1299fe197240c92ceda57fa3db90ef3b41278e1a --- M em100.c 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/32/47732/1
diff --git a/em100.c b/em100.c index 09cc490..e72f181 100644 --- a/em100.c +++ b/em100.c @@ -941,7 +941,7 @@ /* Set up signal handler. This is used for two reasons: * 1) to create a way to cleanly exit trace mode. * 2) to make sure that the em100 is not left in an improper state - * when receiving SIGINT for other reasons during operation. In + * when receiving SIGINT/SIGTERM for other reasons during operation. In * this second case, we just ignore SIGINT until em100 naturally * terminates or receives a second signal. This is OK because the * utility is short-running in nature. @@ -950,6 +950,7 @@ signal_action.sa_flags = 0; sigemptyset(&signal_action.sa_mask); sigaction(SIGINT, &signal_action, NULL); + sigaction(SIGTERM, &signal_action, NULL);
if (em100->hwversion == HWVERSION_EM100PRO || em100->hwversion == HWVERSION_EM100PRO_EARLY) { printf("MCU version: %d.%02d\n", em100->mcu >> 8, em100->mcu & 0xff);
Ryan O'Leary has posted comments on this change. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Patch Set 1: Code-Review+2
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Patch Set 1: Code-Review+2
(2 comments)
https://review.coreboot.org/c/em100/+/47732/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/em100/+/47732/1//COMMIT_MSG@14 PS1, Line 14: calls killall calls just one `calls` is enough: killall calls
https://review.coreboot.org/c/em100/+/47732/1/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/47732/1/em100.c@944 PS1, Line 944: In very minor nit: I'd move this to the next line
Hello build bot (Jenkins), Patrick Georgi, Ryan O'Leary, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/em100/+/47732
to look at the new patch set (#2).
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Catch SIGTERM in addition to SIGINT
SIGINT catches CTRL-C. However, if a user will just terminate the em100 utility by running killall without any signal argument, e.g. $ killall em100 The utility will not leave the em100 utility in a good state and and it will stop working on consecutive calls. Hence catch SIGTERM as well, to make killall calls non-lethal.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I1299fe197240c92ceda57fa3db90ef3b41278e1a --- M em100.c 1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/32/47732/2
Stefan Reinauer has posted comments on this change. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/em100/+/47732/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/em100/+/47732/1//COMMIT_MSG@14 PS1, Line 14: calls killall calls
just one `calls` is enough: killall calls
Don't know what was up with my english last night. Thanks 😊
https://review.coreboot.org/c/em100/+/47732/1/em100.c File em100.c:
https://review.coreboot.org/c/em100/+/47732/1/em100.c@944 PS1, Line 944: In
very minor nit: I'd move this to the next line
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Patch Set 2: Code-Review+2
Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/47732 )
Change subject: Catch SIGTERM in addition to SIGINT ......................................................................
Catch SIGTERM in addition to SIGINT
SIGINT catches CTRL-C. However, if a user will just terminate the em100 utility by running killall without any signal argument, e.g. $ killall em100 The utility will not leave the em100 utility in a good state and and it will stop working on consecutive calls. Hence catch SIGTERM as well, to make killall calls non-lethal.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I1299fe197240c92ceda57fa3db90ef3b41278e1a Reviewed-on: https://review.coreboot.org/c/em100/+/47732 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com --- M em100.c 1 file changed, 5 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved
diff --git a/em100.c b/em100.c index 09cc490..349f102 100644 --- a/em100.c +++ b/em100.c @@ -941,15 +941,16 @@ /* Set up signal handler. This is used for two reasons: * 1) to create a way to cleanly exit trace mode. * 2) to make sure that the em100 is not left in an improper state - * when receiving SIGINT for other reasons during operation. In - * this second case, we just ignore SIGINT until em100 naturally - * terminates or receives a second signal. This is OK because the - * utility is short-running in nature. + * when receiving SIGINT/SIGTERM for other reasons during operation. + * In this second case, we just ignore the first signal until em100 + * naturally terminates or receives a second signal. This is OK + * because the utility is short-running in nature. */ signal_action.sa_handler = exit_handler; signal_action.sa_flags = 0; sigemptyset(&signal_action.sa_mask); sigaction(SIGINT, &signal_action, NULL); + sigaction(SIGTERM, &signal_action, NULL);
if (em100->hwversion == HWVERSION_EM100PRO || em100->hwversion == HWVERSION_EM100PRO_EARLY) { printf("MCU version: %d.%02d\n", em100->mcu >> 8, em100->mcu & 0xff);