!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

1180 Members
“There are still many issues with the Darwin platform but most of it is quite usable.” — http://yves.gnu-darwin.org193 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
22 Dec 2025
@reckenrode:matrix.orgRandy Eckenrodehttps://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/libsyscall/wrappers/select-base.c#L16916:58:24
@reckenrode:matrix.orgRandy EckenrodeIt appears the check may be happening prior to the syscall?17:00:49
@ihar.hrachyshka:matrix.orgIhar Hrachyshkaimplies we would need our own libSystem or smth? :D17:01:09
@reckenrode:matrix.orgRandy EckenrodeDarwin doesn’t support alternate libcs. There is no guarantee of syscall compatibility between kernel versions.17:01:45
@reckenrode:matrix.orgRandy Eckenrode(You can try to do it. Go did. Someone got Musl working. If you encounter problems, you’ll be informed that you shouldn’t be doing that.)17:02:35
@ihar.hrachyshka:matrix.orgIhar Hrachyshkaguess we could ship a custom select in glib... with some kind of runtime check during build to avoid broken glib if they ever change the behavior...17:04:34
@reckenrode:matrix.orgRandy Eckenrodehttps://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/bsd/sys/_types/_fd_def.h#L37_L4017:04:36
@reckenrode:matrix.orgRandy Eckenrode What happens if you define your own FD_SETSIZE? 17:04:52
@ihar.hrachyshka:matrix.orgIhar HrachyshkaI assume that since libSystem is as it was compiled with the 1024 limit, it won't do much. but let me check.17:05:51
@reckenrode:matrix.orgRandy EckenrodeThe checks are inline functions in the header.17:06:44
@reckenrode:matrix.orgRandy Eckenrode Or setting _DARWIN_UNLIMITED_SELECT with select? 17:07:08
@reckenrode:matrix.orgRandy Eckenrode * Or defining _DARWIN_UNLIMITED_SELECT when using select? 17:07:19
@reckenrode:matrix.orgRandy Eckenrode * Or defining _DARWIN_UNLIMITED_SELECT when using select or pselect? 17:07:42
@ihar.hrachyshka:matrix.orgIhar Hrachyshka

I copied half of that file, commented out include for select.h, removed the check and now it works

=== Test 2: pselect() with FD >= FD_SETSIZE (DANGEROUS!) ===
This test intentionally demonstrates undefined behavior
Attempting to add FD 1024 to fd_set (FD_SETSIZE=1024)...
WARNING: This will cause undefined behavior!
Before FD_SET: fd_set memory looks normal
fd_set bytes before: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Calling FD_SET(1024, &dangerous_set)...
fd_set bytes after:  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Memory corruption may have occurred!
Attempting pselect() with corrupted fd_set...
pselect() unexpectedly succeeded with 0 ready FDs

I don't know if "works" means more than "it returned 0" but...

17:11:29

Show newer messages


Back to Room ListRoom Version: 6