Bug 258010 - kqueue shortcoming for desktop usage
Summary: kqueue shortcoming for desktop usage
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 258974
  Show dependency treegraph
 
Reported: 2021-08-23 17:28 UTC by Tobias C. Berner
Modified: 2021-10-21 14:29 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias C. Berner freebsd_committer 2021-08-23 17:28:58 UTC
Moin moin


FreeBSDs file monitoring via kqueue/kevent requires files to be opened to be monitored.


This has a few draw back which mostly crop up in desktop systems (gnome, kde, ...) that 
have support for monitoring and indexing the users home directory.



Issue 1: A big ~ leads to file handle exhaustion

As all files have to be opened the kern.maxfiles sysctl needs to be tuned by users. 

=> desktops won't work out of the box for those users
=> unnecessary crashes happening on startup of desktop sessions


Issue 2: Socket files cannot be monitored

As open() cannot be called on socket files, you cannot monitor a socket file for its deletion.




Linux's file monitoring seems to be able to support these use cases -- maybe a 
re-implementation of their file monitoring should be considered inside FreeBSD. 
An other option would probably be to extend kqueue for these use cases.



mfg Tobias
Comment 1 Mark Johnston freebsd_committer 2021-10-21 14:29:08 UTC
Regarding issue 2, it's now possible to open unix sockets with open(O_PATH): https://cgit.freebsd.org/src/commit/?id=2bd9826995ca6b23f8b088cfa035c0ad1c578ac3

For now kevent() on such fds is not permitted, but I think we could enable EVFILT_VNODE events on them as was done for named pipes recently:
https://cgit.freebsd.org/src/commit/?id=7259ca31048e5ced8e7f90657a3d7084aeafdf51

Would that be sufficient here?