PDA

View Full Version : Exclude /proc being watched by the intfilesystemwatcher installed by QFileSystemModel



kodanda
26th March 2015, 12:43
Hi,

I am trying to display "/" in a treeView. I have a QFileSystemModel with setRootIndex("/"). I want to do some deep file search on this fileSystemModel. So create a signal/slot connection

connect(fileModel, SIGNAL(directoryLoaded(QString), this, on_dir_tree_loaded() ))

The problem is that the internal QFileSystemWatcher attached to QFileSystemModel never finishes reading /proc and spits out error messages like

QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Permission denied
QFileSystemWatcher: failed to add paths: /proc/57/task/57/ns

I guess that there are new system processes continuously making entries inside /proc and are causing the problem.

How can I exclude /proc being watched, or alternatively get around this problem?

Cheers,
Kodanda

jefftee
26th March 2015, 20:10
I am assuming / and /proc are different mount points in your file system? If so, can you just iterate over the various mount points and only add those to QFileSystemWatcher that you actually want to watch?

i.e. Use QStorageInfo::mountedVolumes()?

Edit: One more thought, have you tried removing /proc after you set the root to "/"? Perhaps QFileSystemWatcher::removePath("/proc") may accomplish what you want?