Util-Linux Archive on lore.kernel.org
 help / Atom feed
* Using libmount to track mount/umount
@ 2018-08-14 13:18 Edward Diener
  2018-08-15  7:03 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Edward Diener @ 2018-08-14 13:18 UTC (permalink / raw)
  To: util-linux

I would like to use the libmount library to track end-user mount/umount 
commands. My first question regards the use of the monitor. What is the 
difference between userspace monitoring and kernel VFS monitoring ?

Edward Diener

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Using libmount to track mount/umount
  2018-08-14 13:18 Using libmount to track mount/umount Edward Diener
@ 2018-08-15  7:03 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2018-08-15  7:03 UTC (permalink / raw)
  To: Edward Diener; +Cc: util-linux

On Tue, Aug 14, 2018 at 09:18:26AM -0400, Edward Diener wrote:
> I would like to use the libmount library to track end-user mount/umount
> commands. My first question regards the use of the monitor. What is the
> difference between userspace monitoring and kernel VFS monitoring ?

The userspace handler also monitor writes to /run/mount/utab, it's
important for options like user= or some NFS options maintained in
userspace only. Anyway, if do you not care about options than it's
probably enough to monitor VFS.

The userspace monitor has been mostly implemented for systemd where is
required to have information about all options, for more details see
https://github.com/systemd/systemd/blob/master/src/core/mount.c#L1701

See also test program in the code:
https://github.com/karelzak/util-linux/blob/master/libmount/src/monitor.c#L823


The another possibility to monitor VFS is to use directly poll() for 
/proc/self/mountinfo and than mnt_new_tabdiff(), see findmnt --poll:
https://github.com/karelzak/util-linux/blob/master/misc-utils/findmnt.c#L1071
In this case you do not need the mnt_new_monitor(), but libmnt_monitor
is probably better for complex things and epoll().


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14 13:18 Using libmount to track mount/umount Edward Diener
2018-08-15  7:03 ` Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox