Przeglądaj źródła

Get env_posix.cc building under Fuchsia.

PiperOrigin-RevId: 395824737
main
leveldb Team 3 lat temu
committed by Victor Costan
rodzic
commit
c5d5174a66
1 zmienionych plików z 7 dodań i 0 usunięć
  1. +7
    -0
      util/env_posix.cc

+ 7
- 0
util/env_posix.cc Wyświetl plik

@ -6,7 +6,9 @@
#include <fcntl.h>
#include <pthread.h>
#include <sys/mman.h>
#ifndef __Fuchsia__
#include <sys/resource.h>
#endif
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
@ -757,6 +759,10 @@ int MaxOpenFiles() {
if (g_open_read_only_file_limit >= 0) {
return g_open_read_only_file_limit;
}
#ifdef __Fuchsia__
// Fuchsia doesn't implement getrlimit.
g_open_read_only_file_limit = 50;
#else
struct ::rlimit rlim;
if (::getrlimit(RLIMIT_NOFILE, &rlim)) {
// getrlimit failed, fallback to hard-coded default.
@ -767,6 +773,7 @@ int MaxOpenFiles() {
// Allow use of 20% of available file descriptors for read-only files.
g_open_read_only_file_limit = rlim.rlim_cur / 5;
}
#endif
return g_open_read_only_file_limit;
}

Ładowanie…
Anuluj
Zapisz