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:
parent
4d88f92b76
commit
8c8a4c8d09
|
@ -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();
|
||||
|
|
16
ircd/fs.cc
16
ircd/fs.cc
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue