!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

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

Load older messages


SenderMessageTime
22 Dec 2025
@ihar.hrachyshka:matrix.orgIhar Hrachyshkathe check compiled with xcode clang returns 115:42:22
@reckenrode:matrix.orgRandy Eckenrodehttps://pubs.opengroup.org/onlinepubs/9799919799/functions/poll.html15:42:38
@reckenrode:matrix.orgRandy Eckenrode ppoll is apparently part of POSIX now. No idea if or when Apple will add it. 15:43:07
@ihar.hrachyshka:matrix.orgIhar Hrachyshkathey could at least maybe conditionalize it. like if it's null and the user needs some non-standard behavior, go through select. otherwise... I think main loop for qemu doesn't pass nulls there.15:43:45
@ihar.hrachyshka:matrix.orgIhar Hrachyshkait's 2024 posix so rather new15:43:59
@reckenrode:matrix.orgRandy EckenrodeYeah. Apple is adding newer stuff, but they still only go for UNIX03 when they certify.15:44:53
@reckenrode:matrix.orgRandy EckenrodeSo no guarantee, particularly if they have alternative APIs already.15:45:24
@reckenrode:matrix.orgRandy EckenrodeDoes that means it works now?15:46:11
@ihar.hrachyshka:matrix.orgIhar Hrachyshka exit(1); /* Does not work for devices -- fail */ 15:46:34
@reckenrode:matrix.orgRandy EckenrodeThat code is almost twenty years old. It wouldn’t be the first time Glib makes an assumption that doesn’t apply on modern Darwin.15:46:48
@reckenrode:matrix.orgRandy Eckenrode What is the expected semantics when the user provides NULL fds and nfds 0? 15:47:44
@reckenrode:matrix.orgRandy Eckenrode * What are the expected semantics when the user provides NULL fds and nfds 0? 15:47:57
@reckenrode:matrix.orgRandy EckenrodeIs it equivalent to passing an empty array?15:48:53
@reckenrode:matrix.orgRandy Eckenrode macOS supports pselect but not ppoll? 15:51:13
@reckenrode:matrix.orgRandy Eckenrode Let’s look at the implementation. The signature takes a pointer, so NULL should be valid. 15:52:54
@ihar.hrachyshka:matrix.orgIhar Hrachyshkaone could probably implement g_poll conditioning to default to poll but fall back to select if a) any device fds passed or b) fds is null. then for most calls we would use poll.15:53:06
@ihar.hrachyshka:matrix.orgIhar Hrachyshka

that's on nixos

(ins)[nix-shell:/tmp]$ ./a.out
poll() returned: 0

(ins)[nix-shell:/tmp]$ cat test.c
#include <stdio.h>
#include <poll.h>
#include <errno.h>
#include <string.h>

int main() {
    int result = poll(NULL, 0, 1000);

    printf("poll() returned: %d\n", result);

    if (result == -1) {
        printf("Error: %s\n", strerror(errno));
    }

    return 0;
}


(ins)[nix-shell:/tmp]$ clang ./test.c

(ins)[nix-shell:/tmp]$ ./a.out
poll() returned: 0
15:53:15
@ihar.hrachyshka:matrix.orgIhar Hrachyshkaactuall it returns the same zero on darwin, not sure if there's more than just that they are looking for...15:54:09
@ihar.hrachyshka:matrix.orgIhar Hrachyshkamaybe the original reasoning documented in the comment is no longer applicable, but tap device polling is still an issue.15:55:30
@reckenrode:matrix.orgRandy EckenrodeMaybe it only works on newer macOS?15:57:29
@hexa:lossy.networkhexait's a bit surprising that nix-darwin does not have a system.autoUpgrade like option 🤔15:58:04
@hexa:lossy.networkhexawhat I need is to keep the machines in sync with a flake ref15:58:43
@reckenrode:matrix.orgRandy Eckenrode

The test is whether it supports devices. According to POSIX:

The poll() and ppoll() functions shall support regular files, terminal and pseudo-terminal devices, FIFOs, pipes, and sockets. The behavior of poll() and ppoll() on elements of fds that refer to other types of file is unspecified.

16:00:23
@reckenrode:matrix.orgRandy EckenrodeSo it doesn’t appear that it’s required to support devices other than (P)TTYs.16:01:03
@ihar.hrachyshka:matrix.orgIhar Hrachyshkait's a gnu world...16:01:17
@reckenrode:matrix.orgRandy EckenrodeIf Glib does want to support that, they need emulation.16:01:33
@reckenrode:matrix.orgRandy Eckenrode It might be possible to do it with kqueue. That’s how Apple implements poll in XNU. They probably don’t support devices because it’s not required. 16:02:58
@ihar.hrachyshka:matrix.orgIhar Hrachyshka qemu defines fd array as GPollFD poll_fds[1024 * 2]; /* this is probably overkill */ which AFAIU is above the limit on darwin. but then it's probably not something that would be solved by reducing the size of the array since - I assume - qemu has a good reason to listen on so many files (is it because of how nix store is overlayed into these vms?) 16:04:40
@reckenrode:matrix.orgRandy EckenrodeDoes it work if the fd limit is increased?16:05:31
@ihar.hrachyshka:matrix.orgIhar Hrachyshkamaybe I should (somehow) map fds opened by the process to actual files and see what's in the top16:05:43

Show newer messages


Back to Room ListRoom Version: 6