In gspawn.c, use sysconf() system call on Mac OS, instead of default maxfiles limit of 4096
While working on vte#296 (closed) I came across an issue where vte was unable to get the maxfiles limit (ulimit -n) on MacOS. I was able to fix it there by using the sysconf() system call on macos, rather than just defaulting to 4096. both sysconf() and getrlimit() are available on macos, but sysconf() is async-signal safe whereas getrlimit() is not.
This is according to https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigaction.2.html
If you add || defined(__APPLE__)
to https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gspawn.c#L1276 that will let you check the actual limit of open files on macos, rather than defaulting to the hard limit of 4096
Edited by Andre Klapper