by amiga386 1 year ago

OK, great.

Can I call poll(2) on a terminal device's file descriptor?

Requirement for certification: https://pubs.opengroup.org/onlinepubs/9799919799.2024edition...

> The poll() and ppoll() functions shall support regular files, terminal and pseudo-terminal devices, FIFOs, pipes, and sockets.

Apple (last time I checked): https://developer.apple.com/library/archive/documentation/Sy...

> BUGS: The poll() system call currently does not support devices.

I asked the same question of Sequoia: https://news.ycombinator.com/item?id=41822308

shiomiru 1 year ago

I had to work around this recently - it involved reimplementing my poll wrapper on top of select(), with the proprietary macOS extension that makes it support unlimited fds. (Of course -D_DARWIN_UNLIMITED_SELECT is completely unportable, so I still need poll too.)

Meanwhile poll() just works on Linux and the BSDs, certified or not.

johnisgood 1 year ago

And someone said:

> It's not simply that certification costs money. It's that a lot of modern UNIX-like operating systems don't adhere to the UNIX spec. For example, the OpenBSD man pages specify the ways in which they diverge from POSIX and UNIX in the Standards section: https://man.openbsd.org/sh.1#STANDARDS, https://man.openbsd.org/awk.1#STANDARDS. Often times these are small deviations that might not matter to most people, but it means that they aren't UNIX.

Except it seems like macOS diverges, too, yet it is certified. I wonder in what other ways it diverges.

veggieroll 1 year ago

I don't think it's that surprising that the Open Group would cut corners certifying Unix compatibility.

mamcx 1 year ago

Also, the weird `fsync` behaviors is not part of it?

qhwudbebd 1 year ago

I came here to mention this too, but saw you'd beaten me to it. It's remarkable how bad non-free OSes are at maintaining basic infrastructure in their kernel and userspace compared to Linux and the BSDs isn't it? Basic bugs get neglected for decades in favour of rearranging the cosmetics - in this case, it's been more than 20 years since I first reported this to Apple's /dev/null service, and I'm sure I wasn't first and I'm only one of many.