mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-01-21 20:25:15 +08:00
Merge pull request #67 from trapexit/priority
attempt to set priority to -10 on startup. closes #65
This commit is contained in:
commit
ffc90f52bc
|
@ -82,7 +82,7 @@ namespace local
|
|||
{
|
||||
return fs::basename(argv[0]);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
get_fuse_operations(struct fuse_operations &ops)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue
Block a user