| 1 | #define _BSD_SOURCE |
| 2 | #include <nl_types.h> |
| 3 | #include <stdint.h> |
| 4 | #include <endian.h> |
| 5 | #ifdef __wasilibc_unmodified_upstream // wasi-libc doesn't support catgets yet |
| 6 | #include <sys/mman.h> |
| 7 | #endif |
| 8 | |
| 9 | #define V(p) be32toh(*(uint32_t *)(p)) |
| 10 | |
| 11 | int catclose (nl_catd catd) |
| 12 | { |
| 13 | #ifdef __wasilibc_unmodified_upstream // wasi-libc doesn't support catgets yet |
| 14 | 	char *map = (char *)catd; |
| 15 | 	munmap(map, V(map+8)+20); |
| 16 | #endif |
| 17 | 	return 0; |
| 18 | } |