0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd::fs: Add an RLIMIT_FSIZE sampler in support section.

This commit is contained in:
Jason Volk 2020-03-20 10:54:14 -07:00
parent 4d88f92b76
commit 8c8a4c8d09
2 changed files with 18 additions and 2 deletions

View file

@ -33,8 +33,8 @@ namespace ircd::fs::support
// Test if fallocate() is supported at target path
bool fallocate(const string_view &path, const write_opts &wopts = write_opts_default);
// Get the limit for number of opened files
size_t rlimit_nofile();
size_t rlimit_nofile(); // Get the limit for number of opened files
size_t rlimit_fsize(); // Get the limit for a file's size
// Dump information to infolog
void dump_info();

View file

@ -347,6 +347,22 @@ catch(const std::system_error &e)
throw;
}
#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_FSIZE)
size_t
ircd::fs::support::rlimit_fsize()
{
rlimit rlim;
syscall(getrlimit, RLIMIT_FSIZE, &rlim);
return rlim.rlim_cur;
}
#else
size_t
ircd::fs::support::rlimit_fize()
{
return -1;
}
#endif
#if defined(HAVE_SYS_RESOURCE_H) && defined(RLIMIT_NOFILE)
size_t
ircd::fs::support::rlimit_nofile()