summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/locale/catclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/locale/catclose.c')
-rw-r--r--libc-top-half/musl/src/locale/catclose.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/locale/catclose.c b/libc-top-half/musl/src/locale/catclose.c
new file mode 100644
index 0000000..a110246
--- /dev/null
+++ b/libc-top-half/musl/src/locale/catclose.c
@@ -0,0 +1,18 @@
+#define _BSD_SOURCE
+#include <nl_types.h>
+#include <stdint.h>
+#include <endian.h>
+#ifdef __wasilibc_unmodified_upstream // wasi-libc doesn't support catgets yet
+#include <sys/mman.h>
+#endif
+
+#define V(p) be32toh(*(uint32_t *)(p))
+
+int catclose (nl_catd catd)
+{
+#ifdef __wasilibc_unmodified_upstream // wasi-libc doesn't support catgets yet
+ char *map = (char *)catd;
+ munmap(map, V(map+8)+20);
+#endif
+ return 0;
+}