* [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3)
2023-10-06 9:45 7% [PATCH 0/5] Dragonfly BSD support Eric Wong
@ 2023-10-06 9:46 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
DragonFlyBSD matches OpenBSD behavior in freeing every single key on
hdestroy(3). I suppose hdestroy(3) is neglected enough these days that
nobody cares and we'll likely introduce a small C hash table such as
khash (also used within git).
---
lib/PublicInbox/xap_helper.h | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index a78a3f76..3fa615a5 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -491,11 +491,20 @@ static enum exc_iter dump_roots_iter(struct req *req,
static char *hsearch_enter_key(char *s)
{
-#if defined(__OpenBSD__) /* hdestroy frees each key */
+#if defined(__OpenBSD__) || defined(__DragonFly__)
+ // hdestroy frees each key on some platforms,
+ // so give it something to free:
char *ret = strdup(s);
if (!ret) perror("strdup");
return ret;
-#endif // glibc, musl, FreeBSD, NetBSD do not free keys
+// AFAIK there's no way to detect musl, assume non-glibc Linux is musl:
+#elif defined(__GLIBC__) || defined(__linux__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__)
+ // do nothing on these platforms
+#else
+#warning untested platform detected, unsure if hdestroy(3) frees keys
+#warning contact us at meta@public-inbox.org if you get segfaults
+#endif
return s;
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/5] Dragonfly BSD support
@ 2023-10-06 9:45 7% Eric Wong
2023-10-06 9:46 7% ` [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3) Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-10-06 9:45 UTC (permalink / raw)
To: meta
Got one tmpfs + EVFILT_VNODE bug fixed in Dragonfly in the
process. Dealing with hdestroy implementation differences
is really making me consider khash...
Also considering using sysdefs-list output via $Config{cc}
to support sendmsg/recvmsg without needing Inline::C. `cc'
seems pretty standard across all *BSDs.
Eric Wong (5):
kqnotify: drop EV_CLEAR (edge triggering)
xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3)
devel/sysdefs-list: show more info regardless of OS
t/dir_idle: dump event list on failure
finalize DragonFlyBSD support
devel/sysdefs-list | 45 +++++++++++++++++------------------
install/os.perl | 7 +++---
lib/PublicInbox/Daemon.pm | 4 ++--
lib/PublicInbox/IPC.pm | 1 +
lib/PublicInbox/KQNotify.pm | 2 +-
lib/PublicInbox/MboxLock.pm | 10 +++++---
lib/PublicInbox/POP3D.pm | 4 ++--
lib/PublicInbox/TestCommon.pm | 19 +++++++++++++--
lib/PublicInbox/xap_helper.h | 13 ++++++++--
t/dir_idle.t | 8 ++++---
t/ds-kqxs.t | 5 ++--
t/kqnotify.t | 28 +++++++++++++++++++++-
t/pop3d-limit.t | 4 +---
t/pop3d.t | 6 ++---
t/search.t | 2 +-
xt/pop3d-mpop.t | 5 ++--
16 files changed, 108 insertions(+), 55 deletions(-)
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-10-06 9:45 7% [PATCH 0/5] Dragonfly BSD support Eric Wong
2023-10-06 9:46 7% ` [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3) Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).