For anyone else seeing this thread, I don’t need any more examples of library sizes/maxfiles. I have obtained an example where one user has enough library items to exceed the allowed open files for the whole system. From some of the “build threads” available here, I know there are more. Given that user libraries can grow irrespective of the system’s RAM, this situation will become more prevalent, especially considering that lately users can add library types with a greater file count / size ratio (photos and music).
Given how detrimental exceeding the open file count can be, I’d be scared to release any implementation using this mechanism of file system change detection. I suppose that it could read the maxfiles values, but this is yet another step in the complexity on this platform that already greatly exceeds that of others.
Let’s be honest here: kqueue is designed to detect changes associated with an open file descriptor. Using this to detect changes in the file system is a bit of a hack. While it works on a limited scale, doing this on large file system trees is abusing the system to accomplish a task for which it was not designed. A proper file system change detection system needs to be implemented in the kernel at its VFS layer.