Page MenuHomePhabricator

daemon is deprecated on MAC OSX
Open, Needs TriagePublic

Description

Not sure what the fix should be, but I just saw this while building on OSX:

../../src/bitcoind.cpp:166:17: warning: 'daemon' is deprecated: first deprecated in macOS 10.5 - Use posix_spawn APIs instead. [-Wdeprecated-declarations]

if (daemon(1, 0)) {
    ^

/usr/include/stdlib.h:285:6: note: 'daemon' has been explicitly marked deprecated here
int daemon(int, int) DARWIN_1050(daemon) OSX_AVAILABLE_BUT_DEPRECATED_MSG(MAC_10_0, MAC_10_5, IPHONE_2_0, IPHONE_2_0, "Use posix_spawn APIs instea...

Event Timeline

This documentation states that Apple has deprecated this functionality purposely on their lib, and it would be replaced by launchd.

I will have to look into this more.

https://developer.apple.com/library/archive/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION64

FWIW -- my two cents here is that I sort of doubt they will actually remove this... since it's been a BSD function for ~30 years. They just don't want people using daemon() or anything that forks because their Apple libs break when you fork. :/