// C
#include <limits.h>
+
+/* This is the timeout used by the "old" API currently being torn down.
+ * It cannot be -1 because then logs won't be flushed. It has to be
+ * some reasonably low value to keep dlogutil responsive. */
+#define DEFAULT_EPOLL_TIMEOUT 100
+
int create_initial_fdis(struct fd_info ***fdis, int enabled_buffers, bool is_pipe, const struct log_config *conf)
{
assert(fdis);
* @param[in] l_file File output metadata
* @return int 0 if successful, a negative value on error, callback's return value if it isn't 0
*/
-int do_print_once(dlogutil_state_s *state, dlogutil_entry_s **out)
+int do_print_once(dlogutil_state_s *state, int timeout, dlogutil_entry_s **out)
{
*out = NULL;
while (state->epoll_cnt > 0) {
if (r == BUFFER_NEWLY_DRAINED
|| r == ALL_BUFFERS_EMPTY) {
- int const nfds = TEMP_FAILURE_RETRY(epoll_wait(state->epollfd, state->evs, state->epoll_cnt, 100));
+ int const nfds = epoll_wait(state->epollfd, state->evs, state->epoll_cnt, timeout);
if (nfds < 0)
return -errno;
{
while (true) {
dlogutil_entry_s *out;
- int r = do_print_once(state, &out);
+ int r;
+ do
+ r = do_print_once(state, DEFAULT_EPOLL_TIMEOUT, &out);
+ while (r == -EINTR);
if (r != 0)
return r;