Displaying 2 results from an estimated 2 matches for "event_list_append".
2020 Oct 20
1
[PATCH nbdkit INCOMPLETE] New filter: exitwhen: exit gracefully when an event occurs.
This incomplete patch adds a new filter allowing more control over
when nbdkit exits. You can now get nbdkit to exit gracefully on
certain events, such as a file being created, a pipe held open by
another process going away, or when another PID exits. There is also
a script option to allow for completely custom events.
It is untested at the moment, I'm posting it to get feedback on the
2020 Oct 21
0
[PATCH nbdkit] New filter: exitwhen: exit gracefully when an event occurs.
...it-when-file-created") == 0 ||
+ strcmp (key, "exit-when-file-deleted") == 0) {
+ event.type = key[15] == 'c' ? EVENT_FILE_CREATED : EVENT_FILE_DELETED;
+ event.u.filename = nbdkit_absolute_path (value);
+ if (event.u.filename == NULL)
+ return -1;
+ if (event_list_append (&events, event) == -1)
+ return -1;
+ return 0;
+ }
+ else if (strcmp (key, "exit-when-pipe-closed") == 0 ||
+ strcmp (key, "exit-when-fd-closed") == 0) {
+ event.type = EVENT_FD_CLOSED;
+ if (nbdkit_parse_int ("exit-when-pipe-closed", va...