forked from openkylin/ukui-search
Optimized the strategy of modifying inotify/max_user_watches.
This commit is contained in:
parent
8ef136bcbd
commit
1303e5f3c9
|
@ -63,6 +63,16 @@ QString SysdbusRegister::setInotifyMaxUserWatchesStep1() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SysdbusRegister::setInotifyMaxUserWatchesStep2() {
|
QString SysdbusRegister::setInotifyMaxUserWatchesStep2() {
|
||||||
|
QFile file("/proc/sys/fs/inotify/max_user_watches");
|
||||||
|
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
return QString();
|
||||||
|
QTextStream ts(&file);
|
||||||
|
QString s = ts.read(512);
|
||||||
|
file.close();
|
||||||
|
if(s.toInt() >= 9999999 ) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
FILE * fp = NULL;
|
FILE * fp = NULL;
|
||||||
char cmd[128];
|
char cmd[128];
|
||||||
|
@ -109,6 +119,7 @@ int SysdbusRegister::AddInotifyMaxUserInstance(int addNum)
|
||||||
return -1;
|
return -1;
|
||||||
QTextStream ts(&file);
|
QTextStream ts(&file);
|
||||||
QString s = ts.read(512);
|
QString s = ts.read(512);
|
||||||
|
file.close();
|
||||||
int instances = s.toInt() + addNum;
|
int instances = s.toInt() + addNum;
|
||||||
|
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
|
|
Loading…
Reference in New Issue