summaryrefslogtreecommitdiffstats
path: root/libmount/src/monitor.c
Commit message (Collapse)AuthorAgeFilesLines
* libmount: avoid possible null pointer dereference [cppcheck]Sami Kerola2019-05-181-6/+9
| | | | | | [libmount/src/monitor.c:797]: (warning) Possible null pointer dereference: me Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: cleanup licenses sections in the filesKarel Zak2018-08-161-3/+8
| | | | | | | | | * add SPDX-License-Identifier (see https://spdx.org/licenses/) * add "This file part of libmount from util-linux project." * use proper text for LGPL-2.1-or-later * use the same texts everywhere Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix compiler warning [-Wunused-parameter]Karel Zak2018-05-031-4/+2Star
| | | | | Reported-by: L A Walsh <lkml@tlinx.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: result of operation is garbage or undefined [clang analyze]Karel Zak2016-03-291-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: fix icc/clang compiler warningsRuediger Meier2016-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | clang warning: libmount/src/tab.c:1833:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mpc) ^~~~ icc printf warnings: libmount/src/monitor.c(348): warning #2279: printf/scanf format not a string literal and no format arguments DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing")); ^ login-utils/vipw.c(348): warning #2279: printf/scanf format not a string literal and no format arguments : _("You are using shadow passwords on this system.\n")); ^ icc enum warnings: disk-utils/fdisk-menu.c(150): warning #188: enumerated type mixed with another type .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD, ^ libsmartcols/src/table_print.c(750): warning #188: enumerated type mixed with another type &width, align, ^ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: fix compiler warnings [-Wmissing-prototypes]Ruediger Meier2016-02-231-4/+4
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libmount: (monitor) remove unnecessary epoll EPOLLPRIKarel Zak2015-09-111-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) don't check for regular mtabKarel Zak2015-09-111-5/+1Star
| | | | | | | | | | | | The monitor supports utab only (as documented). It's application responsibility to use libmount in the right way. It's overkill to check for valid environment during monitor initialization. For example systemd checks for regular mtab during boot, it's better than try to be smart later in libmount monitor when system is already running. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: typo fixesKir Kolyshkin2015-09-031-1/+1
| | | | | | I was reading the code and found these mountinfo typos. Signed-off-by: Kir Kolyshkin <kir@openvz.org>
* libmount: (monitor) fix docsKarel Zak2015-08-191-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup assert() usageKarel Zak2015-08-041-9/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve monitor to be usable for non-root usersKarel Zak2015-06-191-82/+142
| | | | | | | | | | | | | | The current implementation calls mkdir and open(O_CREATE) to initialize /run/mount/utab.lock before it starts to monitor the file. Unfortunately it makes the monitor useless for non-root processes (e.g. systemd --user). The new implementation adds inotify watch for the last existing component in the path (/run/mount/utab.lock) and re-initialize after a change. It makes the monitor robust enough for mkdir/rmdir when monitor is already active. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (docs) fix wordingRonny Chevalier2015-06-031-1/+1
| | | | Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
* libmount: (docs) fix typoRonny Chevalier2015-06-031-1/+1
| | | | Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
* libmount: fix mnt_monitor_event_cleanup()Karel Zak2015-06-011-13/+26
| | | | | | | We have to call epoll to drain mountinfo events too. The problem is visible if the monitor epoll FD is within another (top-level) epoll. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (docs) add monitor exampleKarel Zak2015-01-131-0/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup gtk-docs warningsKarel Zak2015-01-131-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) make mnt_monitor_next_changed() usable for epoll version tooKarel Zak2015-01-061-14/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* linmount: (monitor) refresh docs, headers and symbols tableKarel Zak2015-01-061-7/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) use inotify for utab lock fileKarel Zak2015-01-061-73/+75
| | | | | | | | | | | | It's better than monitor utab directly. The utab is updated by rename(2) and it's really tricky for inotify, because it's necessary to monitor all /run/mount directory and then it's necessary to verify that the renamed file is really "utab". The new concept is without possible false positives and it also triggers the change when utab update is really done. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) add kernel mountninfo monitoringKarel Zak2015-01-061-46/+175
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: (monitor) cleanup wait/verify stuffKarel Zak2015-01-061-74/+265
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make public top-level monitor FD onlyKarel Zak2015-01-061-162/+221
| | | | | | | | | | | | | | | | | | | We need full control on changes evaluation, so it's better to hide all in our private epoll. This change also significantly simplify the API. mn = mnt_new_monitor(); mnt_monitor_enable_userapce(mn, TRUE, NULL); mnt_monitor_enable_kenrel(mn, TRUE); fd = mnt_monitor_get_fd(mn); ... <use 'fd' in epoll controlled by your application> ... while (mnt_monitor_next_changed(mn, &filename, NULL) == 0) printf("%s: change detected\n", filename); Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: monitor unref function refactoringKarel Zak2015-01-061-14/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup monitor testKarel Zak2015-01-061-26/+34
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: split monitor initializationKarel Zak2015-01-061-112/+176
| | | | | | | The patch introduces mnt_monitor_enable_*() functions (now for userspace only) to make the API easy to use for high-level purpose. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add new libmnt_monitor APIKarel Zak2014-12-051-0/+421
It's usually enough to us [e]poll() to monitor kernel mount table, but there is no way how to monitor changes in userspace mount options (e.g. _netdev). The management of these mount options is completely hidden in libmount and /rub/mount/utab is private libmount file. This patch introduces new libmnt_mount API to monitor also userspace mount table. Signed-off-by: Karel Zak <kzak@redhat.com>