Browse Source

attempt to set priority to -10 on startup. closes #65

pull/67/head
Antonio SJ Musumeci 10 years ago
parent
commit
5fb277529f
  1. 3
      src/mergerfs.cpp
  2. 10
      src/resources.cpp
  3. 3
      src/resources.hpp

3
src/mergerfs.cpp

@ -152,10 +152,13 @@ namespace local
void
setup_resources(void)
{
const int prio = -10;
std::srand(time(NULL));
mergerfs::resources::reset_umask();
mergerfs::resources::maxout_rlimit_nofile();
mergerfs::resources::maxout_rlimit_fsize();
mergerfs::resources::setpriority(prio);
}
}

10
src/resources.cpp

@ -40,7 +40,7 @@ namespace mergerfs
}
int
maxout_rlimit(int resource)
maxout_rlimit(const int resource)
{
int rv;
struct rlimit rlim;
@ -78,5 +78,13 @@ namespace mergerfs
{
return maxout_rlimit(RLIMIT_FSIZE);
}
int
setpriority(const int prio)
{
const int SELF = 0;
return ::setpriority(PRIO_PROCESS,SELF,prio);
}
}
}

3
src/resources.hpp

@ -27,8 +27,9 @@ namespace mergerfs
namespace resources
{
int reset_umask(void);
int maxout_rlimit(int resource);
int maxout_rlimit(const int resource);
int maxout_rlimit_nofile(void);
int maxout_rlimit_fsize(void);
int setpriority(const int prio);
}
}
Loading…
Cancel
Save