#include "os_misc.h"
#include "os_file.h"
+#include "macros.h"
#include <stdarg.h>
# include <log/log.h>
#elif DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD
# include <unistd.h>
+#elif DETECT_OS_OPENBSD
+# include <sys/resource.h>
+# include <sys/sysctl.h>
#elif DETECT_OS_APPLE || DETECT_OS_BSD
# include <sys/sysctl.h>
#elif DETECT_OS_HAIKU
free(meminfo);
return false;
+#elif DETECT_OS_OPENBSD
+ struct rlimit rl;
+ int mib[] = { CTL_HW, HW_USERMEM64 };
+ int64_t mem_available;
+ size_t len = sizeof(mem_available);
+
+ /* physmem - wired */
+ if (sysctl(mib, 2, &mem_available, &len, NULL, 0) == -1)
+ return false;
+
+ /* static login.conf limit */
+ if (getrlimit(RLIMIT_DATA, &rl) == -1)
+ return false;
+
+ *size = MIN2(mem_available, rl.rlim_cur);
+ return true;
#else
return false;
#endif