diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2017-10-26 16:45:12 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2017-10-26 16:45:12 (GMT) |
commit | 6054f36bb658916bd231b9002efb94444e2871c8 (patch) | |
tree | a815500ec9bf0e100f4075a825213605c382def0 /notes/osx.note | |
download | blt-6054f36bb658916bd231b9002efb94444e2871c8.zip blt-6054f36bb658916bd231b9002efb94444e2871c8.tar.gz blt-6054f36bb658916bd231b9002efb94444e2871c8.tar.bz2 |
Squashed 'xpa/' content from commit d6a54301
git-subtree-dir: xpa
git-subtree-split: d6a543018b46c5a6c47b5ff91e0e131549595ca6
Diffstat (limited to 'notes/osx.note')
-rw-r--r-- | notes/osx.note | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/notes/osx.note b/notes/osx.note new file mode 100644 index 0000000..6ba68a7 --- /dev/null +++ b/notes/osx.note @@ -0,0 +1,38 @@ +Mac OS X Leopard v10.5 (MB427Z/A) + +The process has forked and you cannot use this CoreFoundation + +http://developer.apple.com/releasenotes/CoreFoundation/CoreFoundation.html + +CoreFoundation and fork() Due to the behavior of fork(), +CoreFoundation cannot be used on the child-side of fork(). If you +fork(), you must follow that with an exec*() call of some sort, and +you should not use CoreFoundation APIs within the child, before the +exec*(). The applies to all higher-level APIs which use +CoreFoundation, and since you cannot know what those higher-level APIs +are doing, and whether they are using CoreFoundation APIs, you should +not use any higher-level APIs either. This includes use of the +daemon() function. + +Additionally, per POSIX, only async-cancel-safe functions are safe to +use on the child side of fork(), so even use of lower-level +libSystem/BSD/UNIX APIs should be kept to a minimum, and ideally to +only async-cancel-safe functions. + +This has always been true, and there have been notes made of this on +various Cocoa developer mailling lists in the past. But CoreFoundation +is taking some stronger measures now to "enforce" this limitation, so +we thought it would be worthwhile to add a release note to call this +out as well. A message is written to stderr when something uses API +which is definitely known not to be safe in CoreFoundation after +fork(). If file descriptor 2 has been closed, however, you will get no +message or notice, which is too bad. We tried to make processes +terminate in a very recognizable way, and did for a while and that was +very handy, but backwards binary compatibility prevented us from doing +so. + +-------------- + +This is the function you set a debug breakpoint on if you try to fork() in Leopard then call a CoreFoundation method: + +void __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__(void); |