Fix environ enumeration on Apple platforms
authorMatt Glazar <strager@fb.com>
Sat, 4 Feb 2017 00:59:31 +0000 (16:59 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 4 Feb 2017 01:03:06 +0000 (17:03 -0800)
commitc847b1b4b667dcb6d8d8969d24a38a370053130f
treefb545d101113cfc5ae68c911d0776e3f52ef17e1
parentc10a6640488dc4805bc383b98734e9c6bf616be1
Fix environ enumeration on Apple platforms

Summary:
environ is documented to not work very well from .dylib-s (dynamic libraries) on macOS. Use the _NSGetEnviron function instead to get a pointer to environ.

<crt_externs.h> is missing from some iOS SDKs, so forward-declare _NSGetEnviron in such cases.

Reviewed By: Orvid, mzlee

Differential Revision: D4491044

fbshipit-source-id: 886d19bdd63dea14225992446b7ba132faf35054
folly/portability/Stdlib.h