shared/logs-show: introduce journal_browse_prepare()

which combines sigbus_install() and bumping fd limit.
This commit is contained in:
Mike Yuan
2024-08-22 20:33:22 +02:00
parent d71f138156
commit fad3feec12
11 changed files with 32 additions and 47 deletions
+10
View File
@@ -11,7 +11,9 @@
#include "macro.h"
#include "output-mode.h"
#include "rlimit-util.h"
#include "set.h"
#include "sigbus.h"
#include "time-util.h"
typedef struct LogId {
@@ -124,3 +126,11 @@ static inline int journal_get_boots(
advance_older, max_ids,
ret_ids, ret_n_ids);
}
static inline void journal_browse_prepare(void) {
/* Increase max number of open files if we can, we might needs this when browsing journal files,
* which might be split up into many files. */
(void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE);
sigbus_install();
}