https://bugs.openldap.org/show_bug.cgi?id=10419
Issue ID: 10419 Summary: NetBSD does not define union semun nor set _SEM_SEMUN_UNDEFINED Product: LMDB Version: unspecified Hardware: All OS: Other Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: alizter@gmail.com Target Milestone: ---
NetBSD does not define union semun nor set _SEM_SEMUN_UNDEFINED. This means that the union defined when _SEM_SEMUN_UNDEFINED is set is skipped leading to a compilation error.
Adding this to `mdb.c` will fix this issue by setting this variable in NetBSD when it is undefined (and it usually is, I can't speak for the future).
``` diff --git a/mdb.c b/mdb.c index 3e3f529b98..64e5ffd254 100644 --- a/vendor/ocaml-lmdb/mdb.c +++ b/vendor/ocaml-lmdb/mdb.c @@ -176,6 +176,11 @@ # define MDB_FDATASYNC fsync #endif
+/* NetBSD does not define union semun in sys/sem.h */ +#if defined(__NetBSD__) && !defined(_SEM_SEMUN_UNDEFINED) +# define _SEM_SEMUN_UNDEFINED 1 +#endif + #ifndef _WIN32 #include <pthread.h> #include <signal.h>
```
FreeBSD and OpenBSD don't suffer from this issue as they both correctly set that variable.
https://bugs.openldap.org/show_bug.cgi?id=10419
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |0.9.34 Keywords|needs_review |
https://bugs.openldap.org/show_bug.cgi?id=10419
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |TEST Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Howard Chu hyc@openldap.org --- Thanks, added to git c85f161d011a0d0c941c7e9ca61cebbb41e15543
https://bugs.openldap.org/show_bug.cgi?id=10419
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|TEST |FIXED Status|RESOLVED |VERIFIED
https://bugs.openldap.org/show_bug.cgi?id=10419
--- Comment #2 from Quanah Gibson-Mount quanah@openldap.org --- master:
• c85f161d by Ali Caglayan at 2026-01-13T16:39:46+00:00 ITS#10419 LMDB: add support for NetBSD
master3:
• 22206c0f by Ali Caglayan at 2026-01-13T16:50:45+00:00 ITS#10419 LMDB: add support for NetBSD
re0.9:
• 4c84d3a3 by Ali Caglayan at 2026-01-13T16:50:17+00:00 ITS#10419 LMDB: add support for NetBSD