Conversation
irevoire
left a comment
There was a problem hiding this comment.
I was not able to test anything, so you should not merge this.
| errno = 0; // this should not be needed | ||
|
|
||
| if( argc <= 0) { | ||
| g_string_append_printf(out, "No signal were specified\n"); |
There was a problem hiding this comment.
We should return an error here, but I have no idea on how to do this.
main/gridinit.c
Outdated
| str_signal = argv[0]; | ||
| argv++; | ||
| argc--; | ||
| g_string_append_printf(out, "START signal\n"); |
| g_string_append_printf(out, "START signal\n"); | ||
|
|
||
| // first we try to convert the string to an integer | ||
| signal = strtol(str_signal, NULL, 10); // TODO should we autodetect the base? |
There was a problem hiding this comment.
Do we want to allow hexadecimal signals and things like that?
| // we look into the of known signals | ||
| for (struct signal_mapping_s* s = SIGNAL;; s++) { | ||
| if (s->name == NULL) { // we did not find any signals | ||
| g_string_append_printf(out, "Unable to decode the signal %s\n", str_signal); |
| { "SIGSTKFLT", SIGSTKFLT }, | ||
| { "SIGUNUSED", SIGUNUSED }, | ||
| { NULL, 0 }, | ||
| #endif |
There was a problem hiding this comment.
I don’t think we should put this thing here. It’s not good for code readability.
It would probably be best to create a plateform file or a signal file for this.
|
It’s a funny thing that travis do not know But I guess travis uses some old linux. |
| char *name; | ||
| int value; | ||
| } SIGNAL [] = { | ||
| #ifdef __unix__ // the base signals |
There was a problem hiding this comment.
First, lot of copy and paste, you should use a macro
#define ITEM(x) {x, #x}
and have
] SIGNAL [] = {
ITEM(SIGABRT),
ITEM(SIGHUP),
...
}
| { "SIGSTKFLT", SIGSTKFLT }, | ||
| { "SIGUNUSED", SIGUNUSED }, | ||
| { NULL, 0 }, | ||
| #endif |
| { "SIGXCPU", SIGXCPU }, | ||
| { "SIGXFSZ", SIGXFSZ }, | ||
| #else | ||
| #error Your plateform is not supported |
| } | ||
|
|
||
| void signal_process(void *u UNUSED, struct child_info_s *ci) { | ||
| kill(ci->pid, signal); |
There was a problem hiding this comment.
IMO we should emit a message with kill return an error
No description provided.