[Kde-hardware-devel] Solid fstab backend

arrowdodger 6yearold at gmail.com
Wed Nov 26 14:20:02 UTC 2014


Hello.
I've been playing with Solid and found that fstab backend monitors
/etc/mtab file for changes to maintain an up-to-date list of systems
mounts. We at FreeBSD do not have /etc/mtab file, but out Linux
compatability layer provides it (under /proc/mounts path though, but this
is irrelevant).
Out of curiosity i decided to read through FreeBSD source to find the code
which updates mtab file when mount/unmount event is fired. I've found that
mtab is implemented using pseudofs and it's content is being generated on
read() call. Because of that watching for it's changes is useless - it is
never changed and no events would be generated.
I've wrote a simple program that waits for file events using kevent (a
FreeBSD-specific API, which is internally used by QFileSystemWatcher),
added a watcher for /proc/mounts, then mounted flash disk and expectedly
didn't get any event. Doing cat /proc/mounts gave me a list with my flash
disk listed in it.
I've done the same test on various Linuxes (but used inotify API instead of
kevent) and got the same result.

It seem that Solid code that watches for mtab is useless. Or am i
misunderstanding something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20141126/6fdf3a01/attachment-0001.html>


More information about the Kde-hardware-devel mailing list