daemon() is deprecated on OSX since 10.5 (should migrate to posix_spawn()). There are no signs daemon() will get removed by Apple.
[Trivial] Ignore macOS daemon() depracation warning #12941
pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:2018/04/daemon_osx changing 1 files +7 −0-
jonasschnelli commented at 8:21 AM on April 11, 2018: contributor
-
Ignore macOS daemon() depracation warning 12e7c558af
- jonasschnelli added the label macOS on Apr 11, 2018
- jonasschnelli added the label Build system on Apr 11, 2018
-
promag commented at 8:31 AM on April 11, 2018: member
I've tried to remove the warning by replacing
daemon()withposix_spawn()a couple of months ago, but got lost in some problem I can really remember.Is there a motivation to remove the warning other than "just remove the warning"?
-
jonasschnelli commented at 8:44 AM on April 11, 2018: contributor
Is there a motivation to remove the warning other than "just remove the warning"?
I don't see a strategy how to follow Apples deprecation path, so yes, it's just a "remove the warning" thing.
-
kallewoof commented at 8:47 AM on April 11, 2018: member
Weak concept ACK. It seems likely that Apple will never actually remove
daemon(), but if they do, it means nobody will have worked on a solution (since we don't see the warning anymore). -
jonasschnelli commented at 8:49 AM on April 11, 2018: contributor
I guess if the
daemon()function gets removed on OSX we won't detect that in a very verbose way anyways since it bypasses the#ifdef HAVE_DECL_DAEMONpart (It will be detectable through the ./configure output). -
laanwj commented at 9:25 AM on April 11, 2018: member
utACK 12e7c558afb1ddd127229029ef0770184d786927, I don't think we have to worry about apple removing
daemon(), POSIX compatibility is important to them. (though it's not officially a POSIX function, sufficient software uses it to make it effectively one)I guess if the daemon() function gets removed on OSX we won't detect that in a very verbose way anyways since it bypasses the #ifdef HAVE_DECL_DAEMON part (It will be detectable through the ./configure output).
Good point! there is detection in the build system, so we only build this code if the function exists in the first place - overriding the warning is 100% valid.
-
promag commented at 9:31 AM on April 11, 2018: member
utACK 12e7c55.
-
kallewoof commented at 9:33 AM on April 11, 2018: member
I don't think we have to worry about apple removing daemon(), POSIX compatibility is important to them.
Makes sense. utACK 12e7c55.
- randolf approved
- laanwj merged this on Apr 11, 2018
- laanwj closed this on Apr 11, 2018
- laanwj referenced this in commit 807d2ac186 on Apr 11, 2018
-
fanquake commented at 9:47 AM on April 11, 2018: member
now post-tACK https://github.com/bitcoin/bitcoin/commit/12e7c558afb1ddd127229029ef0770184d786927
The best info I can find about Apples deprecation of
daemonis here, however there aren't any hard dates, just the following: "The daemon routine is officially deprecated in Mac OS X 10.5 and later. If you're still using it, you should carefully consider the reason why, and think about how your code might better fit in with the launchd model."I've tested these changes, and they do remove this warning:
CXX libbitcoin_server_a-blockencodings.o bitcoind.cpp:145:17: warning: 'daemon' is deprecated: first deprecated in macOS 10.5 - Use posix_spawn APIs instead. [-Wdeprecated-declarations] if (daemon(1, 0)) { // don't chdir (1), do close FDs (0) ^ /usr/include/stdlib.h:298:6: note: 'daemon' has been explicitly marked deprecated here int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, ... ^ CXX libbitcoin_server_a-chain.o CXX libbitcoin_server_a-checkpoints.o 1 warning generated. - PastaPastaPasta referenced this in commit 22585e5494 on Nov 1, 2020
- MarcoFalke locked this on Sep 8, 2021