fix(server): exit gracefully when iouring not supported (#197)

fix(server): exit gracefully when iouring not supported #181

Signed-off-by: iko1 <me@remotecpp.dev>
This commit is contained in:
iko1 2022-07-09 18:44:23 +03:00 committed by GitHub
parent 9e36197742
commit 2b0869c16d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <mimalloc-new-delete.h>
#endif
#include <liburing.h>
#include <absl/flags/usage.h>
#include <absl/flags/usage_config.h>
#include <absl/strings/match.h>
@ -167,6 +168,13 @@ Usage: dragonfly [FLAGS]
return 1;
}
int iouring_res = io_uring_queue_init_params(0, nullptr, nullptr);
if (-iouring_res == ENOSYS) {
LOG(ERROR)
<< "iouring system call interface is not supported. Exiting...";
return 1;
}
if (GetFlag(FLAGS_dbnum) > dfly::kMaxDbId) {
LOG(ERROR) << "dbnum is too big. Exiting...";
return 1;