|
| 1 | +commit 3254c4bb0793ab87c674ddd9f404cb21dd20e311 |
| 2 | +Author: Fake Name <fake@gmail.com> |
| 3 | +Date: Thu Dec 11 01:21:19 2025 +0000 |
| 4 | + |
| 5 | + Make `Core_unix` compatible with `musl` |
| 6 | + |
| 7 | +diff --git a/bigstring_unix/src/bigstring_unix_stubs.c b/bigstring_unix/src/bigstring_unix_stubs.c |
| 8 | +index 785ff10..009c2cb 100644 |
| 9 | +--- a/bigstring_unix/src/bigstring_unix_stubs.c |
| 10 | ++++ b/bigstring_unix/src/bigstring_unix_stubs.c |
| 11 | +@@ -28,7 +28,7 @@ |
| 12 | + #define bswap_16 OSSwapInt16 |
| 13 | + #define bswap_32 OSSwapInt32 |
| 14 | + #define bswap_64 OSSwapInt64 |
| 15 | +-#elif __GLIBC__ |
| 16 | ++#elif defined(__linux__) |
| 17 | + #include <byteswap.h> |
| 18 | + #include <malloc.h> |
| 19 | + #else |
| 20 | +diff --git a/core_unix/src/core_unix_stubs.c b/core_unix/src/core_unix_stubs.c |
| 21 | +index 216b5be..847d707 100644 |
| 22 | +--- a/core_unix/src/core_unix_stubs.c |
| 23 | ++++ b/core_unix/src/core_unix_stubs.c |
| 24 | +@@ -378,7 +378,7 @@ CAMLprim value core_unix_fdatasync(value v_fd) { |
| 25 | + return Val_unit; |
| 26 | + } |
| 27 | + #else |
| 28 | +-#warning "_POSIX_SYNCHRONIZED_IO undefined or <= 0; aliasing unix_fdatasync to unix_fsync" |
| 29 | ++//#warning "_POSIX_SYNCHRONIZED_IO undefined or <= 0; aliasing unix_fdatasync to unix_fsync" |
| 30 | + CAMLprim value core_unix_fdatasync(value v_fd) { return core_unix_fsync(v_fd); } |
| 31 | + #endif |
| 32 | + |
| 33 | +@@ -789,7 +789,7 @@ CAMLprim value core_unix_clock_thread_cputime_id_stub(value __unused v_unit) { |
| 34 | + #undef CLOCK |
| 35 | + |
| 36 | + #else |
| 37 | +-#warning "posix timers not present; clock functions undefined" |
| 38 | ++//#warning "posix timers not present; clock functions undefined" |
| 39 | + #endif |
| 40 | + |
| 41 | + /* Resource limits */ |
| 42 | +@@ -1506,7 +1506,7 @@ CAMLprim value core_unix_sched_setscheduler(value v_pid, value v_policy, |
| 43 | + return Val_unit; |
| 44 | + } |
| 45 | + #else |
| 46 | +-#warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined" |
| 47 | ++//#warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined" |
| 48 | + CAMLprim value core_unix_sched_setscheduler(value __unused v_pid, value __unused v_policy, |
| 49 | + value __unused v_priority) { |
| 50 | + caml_invalid_argument("sched_setscheduler unimplemented"); |
| 51 | +@@ -1599,7 +1599,7 @@ CAMLprim value core_unix_strptime_l(value v_locale, value v_allow_trailing_input |
| 52 | + value v_fmt, value v_s) { |
| 53 | + |
| 54 | + locale_t locale = (locale_t)Nativeint_val(v_locale); |
| 55 | +- return core_unix_strptime_gen(locale, v_allow_trailing_input, v_fmt, v_s, strptime_l); |
| 56 | ++ return core_unix_strptime_gen(locale, v_allow_trailing_input, v_fmt, v_s, strptime_callback); |
| 57 | + } |
| 58 | + |
| 59 | + CAMLprim value core_unix_remove(value v_path) { |
| 60 | +diff --git a/filename_unix/src/filename_unix_stubs.c b/filename_unix/src/filename_unix_stubs.c |
| 61 | +index e4826a1..c14cafa 100644 |
| 62 | +--- a/filename_unix/src/filename_unix_stubs.c |
| 63 | ++++ b/filename_unix/src/filename_unix_stubs.c |
| 64 | +@@ -28,7 +28,7 @@ CAMLprim value core_unix_realpath(value v_path) { |
| 65 | + } |
| 66 | + #else |
| 67 | + CAMLprim value core_unix_realpath(value v_path) { |
| 68 | +- char *path = String_val(v_path); |
| 69 | ++ const char *path = String_val(v_path); |
| 70 | + /* [realpath] is inherently broken without GNU-extension, and this |
| 71 | + seems like a reasonable thing to do if we do not build against |
| 72 | + GLIBC. */ |
| 73 | +diff --git a/linux_ext/src/linux_ext_stubs.c b/linux_ext/src/linux_ext_stubs.c |
| 74 | +index 3a948b7..6d9e7f0 100644 |
| 75 | +--- a/linux_ext/src/linux_ext_stubs.c |
| 76 | ++++ b/linux_ext/src/linux_ext_stubs.c |
| 77 | +@@ -230,7 +230,7 @@ CAMLprim value core_linux_sendmsg_nonblocking_no_sigpipe_stub(value v_fd, value |
| 78 | + int count = Int_val(v_count); |
| 79 | + ssize_t ret; |
| 80 | + struct iovec *iovecs = caml_stat_alloc(sizeof(struct iovec) * count); |
| 81 | +- struct msghdr msghdr = {NULL, 0, NULL, 0, NULL, 0, 0}; |
| 82 | ++ struct msghdr msghdr = {NULL, 0, NULL, 0, 0, 0, 0}; |
| 83 | + msghdr.msg_iov = iovecs; |
| 84 | + msghdr.msg_iovlen = count; |
| 85 | + for (--count; count >= 0; --count) { |
| 86 | +diff --git a/time_float_unix/time_unix/dune b/time_float_unix/time_unix/dune |
| 87 | +deleted file mode 100644 |
| 88 | +index 729e749..0000000 |
| 89 | +--- a/time_float_unix/time_unix/dune |
| 90 | ++++ /dev/null |
| 91 | +@@ -1,6 +0,0 @@ |
| 92 | +-(library |
| 93 | +- (name time_unix) |
| 94 | +- (public_name core_unix.time_unix) |
| 95 | +- (libraries time_float_unix) |
| 96 | +- (preprocess |
| 97 | +- (pps ppx_jane))) |
| 98 | +diff --git a/time_float_unix/time_unix/time_unix.ml b/time_float_unix/time_unix/time_unix.ml |
| 99 | +deleted file mode 100644 |
| 100 | +index c1bdb7d..0000000 |
| 101 | +--- a/time_float_unix/time_unix/time_unix.ml |
| 102 | ++++ /dev/null |
| 103 | +@@ -1,4 +0,0 @@ |
| 104 | +-[@@@deprecated "[since 2022-04] Use [Time_float_unix] instead"] |
| 105 | +-(* In the immortal words of MC Hammer: "Stop ... (using) unix time!" *) |
| 106 | +- |
| 107 | +-include Time_float_unix |
0 commit comments