[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
  1. jonasschnelli commented at 8:21 AM on April 11, 2018: contributor

    daemon() is deprecated on OSX since 10.5 (should migrate to posix_spawn()). There are no signs daemon() will get removed by Apple.

  2. Ignore macOS daemon() depracation warning 12e7c558af
  3. jonasschnelli added the label macOS on Apr 11, 2018
  4. jonasschnelli added the label Build system on Apr 11, 2018
  5. promag commented at 8:31 AM on April 11, 2018: member

    I've tried to remove the warning by replacing daemon() with posix_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"?

  6. Empact commented at 8:41 AM on April 11, 2018: member
  7. 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.

  8. 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).

  9. 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_DAEMON part (It will be detectable through the ./configure output).

  10. 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.

  11. promag commented at 9:31 AM on April 11, 2018: member

    utACK 12e7c55.

  12. 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.

  13. randolf approved
  14. laanwj merged this on Apr 11, 2018
  15. laanwj closed this on Apr 11, 2018

  16. laanwj referenced this in commit 807d2ac186 on Apr 11, 2018
  17. 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 daemon is 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.
    
  18. PastaPastaPasta referenced this in commit 22585e5494 on Nov 1, 2020
  19. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me