[vfs] localizable fsnotifier messages

GitOrigin-RevId: 4757b274e7b87548d6110b0372b2c64d8fae6db5
This commit is contained in:
Roman Shevchenko
2020-08-27 18:50:39 +02:00
committed by intellij-monorepo-bot
parent 2e7b1ffa65
commit 7a47d99d43
8 changed files with 23 additions and 44 deletions

View File

@@ -2,21 +2,14 @@
#pragma once
#define VERSION "20191018.1702"
#define VERSION "20200827.1844"
#include <stdbool.h>
#include <stdio.h>
// messaging
typedef enum {
MSG_INSTANCE_LIMIT, MSG_WATCH_LIMIT
} MSG;
void message(MSG id);
// logging
// messaging and logging
void message(const char *text);
void userlog(int priority, const char* format, ...);
#define CHECK_NULL(p, r) if (p == NULL) { userlog(LOG_ERR, "out of memory"); return r; }

View File

@@ -62,7 +62,7 @@ bool init_inotify() {
int e = errno;
userlog(LOG_ERR, "inotify_init: %s", strerror(e));
if (e == EMFILE) {
message(MSG_INSTANCE_LIMIT);
message("inotify.instance.limit");
}
return false;
}
@@ -189,7 +189,7 @@ static int add_watch(int path_len, watch_node* parent) {
static void watch_limit_reached() {
if (!limit_reached) {
limit_reached = true;
message(MSG_WATCH_LIMIT);
message("inotify.watch.limit");
}
}

View File

@@ -33,14 +33,6 @@
#define HELP_MSG \
"Try 'fsnotifier --help' for more information.\n"
#define INSTANCE_LIMIT_TEXT \
"The <b>inotify</b>(7) instances limit reached. " \
"<a href=\"https://confluence.jetbrains.com/display/IDEADEV/Inotify+Instances+Limit\">More details.</a>\n"
#define WATCH_LIMIT_TEXT \
"The current <b>inotify</b>(7) watch limit is too low. " \
"<a href=\"https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit\">More details.</a>\n"
#define MISSING_ROOT_TIMEOUT 1
#define UNFLATTEN(root) (root[0] == '|' ? root + 1 : root)
@@ -152,16 +144,8 @@ static void init_log() {
}
void message(MSG id) {
if (id == MSG_INSTANCE_LIMIT) {
output("MESSAGE\n" INSTANCE_LIMIT_TEXT);
}
else if (id == MSG_WATCH_LIMIT) {
output("MESSAGE\n" WATCH_LIMIT_TEXT);
}
else {
userlog(LOG_ERR, "unknown message: %d", id);
}
void message(const char *text) {
output("MESSAGE\n%s\n", text);
}