https://gitlab.com/worthwhileit/bsd/fsnotifier/-/merge_requests/1

Index: inotify.c
--- inotify.c.orig
+++ inotify.c
@@ -45,8 +45,18 @@ static void watch_limit_reached(void);
 static bool watch_count_initialised = false;
 static void init_watch_count(void) {
   size_t len = 4;
+#if defined(__FreeBSD__)
   sysctlbyname("kern.maxfilesperproc", &watch_count, &len, NULL, 0);
   userlog(LOG_INFO, "kern.maxfilesperproc=%d", watch_count);
+#elif defined(__OpenBSD__)
+  int mib[2];
+  mib[0] = CTL_KERN;
+  mib[1] = KERN_MAXFILES;
+  sysctl(mib, 2, &watch_count, &len, NULL, 0);
+  userlog(LOG_INFO, "kern.maxfiles=%d", watch_count);
+#else
+#error "System doesn't supported yet"
+#endif
 
   userlog(LOG_INFO, 
           "finding a watch descriptor count <= %d which is a power of 2 and which the system will tolerate", 
