A file descriptor should be set to -1 and not 0.
The 0 file descriptor is actually valid.
The signalfd() program accepts an id.
It makes sense to pass this along rather than always forcing -1.
sigset_t set;
} f_signal_t;
- #define f_signal_t_initialize {0, 0, { 0 } }
+ #define f_signal_t_initialize {0, -1, { 0 } }
#define macro_f_signal_t_initialize(flags, id, set) { flags, id, set }
#define macro_f_signal_t_clear(signal) \
signal.flags = 0; \
- signal.id = 0; \
+ signal.id = -1; \
signal.set[0] = 0;
#endif // _di_f_signal_t_
if (!signal) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- int result = signalfd(-1, &signal->set, signal->flags);
+ const int result = signalfd(signal->id, &signal->set, signal->flags);
if (result < 0) {
if (errno == EINVAL) return F_status_set_error(F_parameter);
* @param signal
* The signal settings.
*
+ * If signal.id is -1, then a new file descriptor is created.
+ * Otherwise, signal.id is used as the file descriptor.
+ *
* @return
* F_none on success but no signal found.
* F_device (with error bit) if could not mount the internal inode device.
#ifndef _di_byte_dump_signal_received_
f_status_t byte_dump_signal_received(byte_dump_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_control_signal_received_
f_status_t control_signal_received(control_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fake_signal_received_
f_status_t fake_signal_received(fake_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_firewall_signal_received_
f_status_t firewall_signal_received(firewall_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_basic_list_read_signal_received_
f_status_t fss_basic_list_read_signal_received(fss_basic_list_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_basic_list_write_signal_received_
f_status_t fss_basic_list_write_signal_received(fss_basic_list_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_basic_read_signal_received_
f_status_t fss_basic_read_signal_received(fss_basic_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_basic_write_signal_received_
f_status_t fss_basic_write_signal_received(fss_basic_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_embedded_list_read_signal_received_
f_status_t fss_embedded_list_read_signal_received(fss_embedded_list_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_embedded_list_write_signal_received_
f_status_t fss_embedded_list_write_signal_received(fss_embedded_list_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_extended_list_read_signal_received_
f_status_t fss_extended_list_read_signal_received(fss_extended_list_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_extended_list_write_signal_received_
f_status_t fss_extended_list_write_signal_received(fss_extended_list_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_extended_read_signal_received_
f_status_t fss_extended_read_signal_received(fss_extended_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_extended_write_signal_received_
f_status_t fss_extended_write_signal_received(fss_extended_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_identify_signal_received_
f_status_t fss_identify_signal_received(fss_identify_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_fss_status_code_signal_received_
f_status_t fss_status_code_signal_received(fss_status_code_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_iki_read_signal_received_
f_status_t iki_read_signal_received(iki_read_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_iki_write_signal_received_
f_status_t iki_write_signal_received(iki_write_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}
#ifndef _di_status_code_signal_received_
f_status_t status_code_signal_received(status_code_main_t * const main) {
- if (!main->signal.id) {
+ if (main->signal.id == -1) {
return F_false;
}