Project

General

Profile

Actions

Submit #2905

closed

Add EVFILT_FS

Added by tkusumi over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
04/29/2016
Due date:
% Done:

0%

Estimated time:

Description

Matt (or Sephe),

I'd like to add EVFILT_FS type to kqueue events.
autoumountd which is a userspace daemon of autofs needs this.

EVFILT_FS has existed in FreeBSD since 2004.
EVFILT_FS is triggered only when mounting or unmounting a filesystem.
(FreeBSD later added some NFS events in addition to mount/unmount, but this commit doesn't apply those)

The patch needs to be reviewed as I've only read kern/kern_event.c today to briefly understand the mechanism.

https://leaf.dragonflybsd.org/~tkusumi/diff/0001-sys-kern-Add-EVFILT_FS.patch

sample userspace code
https://leaf.dragonflybsd.org/~tkusumi/diff/kqueue1.c

--
[root@]~# gcc -Wall -g ./kqueue1.c -o ./kqueue1
[root@]~# ./kqueue1
timeout
timeout
timeout
timeout
timeout
timeout
filesystem event filter=-10 mount
timeout
timeout
filesystem event filter=-10 unmount
timeout
timeout
filesystem event filter=-10 mount
filesystem event filter=-10 unmount
timeout
timeout
timeout
^C

Actions

Also available in: Atom PDF