Revision: 1032 http://trac.macosforge.org/projects/darwinbuild/changeset/1032 Author: kvv@apple.com Date: 2012-03-22 16:33:48 -0700 (Thu, 22 Mar 2012) Log Message: ----------- - darwintrace: fixed crash when used by multi-threaded applications Modified Paths: -------------- trunk/CHANGES trunk/darwintrace/darwintrace.c Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/PR-10008999:984 /branches/PR-10307836:993-996 /branches/PR-10363375:959-960 /branches/PR-10397485:967 /branches/PR-10412052:973-975 /branches/PR-10412066:974-975 /branches/PR-10428083:994-997 /branches/PR-10431324:979-980 /branches/PR-10821792:1007-1010 /branches/PR-10827653:1021 /branches/PR-10830883:1015 /branches/PR-11042608:1025 /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 /branches/PR-9697169:1004-1008 /branches/PR-9709247:1002-1009 + /branches/PR-10008999:984 /branches/PR-10307836:993-996 /branches/PR-10363375:959-960 /branches/PR-10397485:967 /branches/PR-10412052:973-975 /branches/PR-10412066:974-975 /branches/PR-10428083:994-997 /branches/PR-10431324:979-980 /branches/PR-10821792:1007-1010 /branches/PR-10827653:1021 /branches/PR-10830883:1015 /branches/PR-11042608:1025 /branches/PR-11056762:1031 /branches/PR-4841388:399-419 /branches/PR-6358021:442-443 /branches/PR-6392966:423-427 /branches/PR-6398060:433-434 /branches/PR-6493844:460-461 /branches/PR-6497694:466-468,471 /branches/PR-6634286:632-650 /branches/PR-6688645:479-490 /branches/PR-6722857:495-499 /branches/PR-6729491:655-664 /branches/PR-6973110:804-813 /branches/PR-7250612:635-650 /branches/PR-7341154:682-694 /branches/PR-7431723:660-664 /branches/PR-7461534:650-664 /branches/PR-7482850:670-671 /branches/PR-7489777:676-731 /branches/PR-7529688:692-694 /branches/PR-7593824:739-772 /branches/PR-7598640:703-731 /branches/PR-7748469:777-785 /branches/PR-7765119:790-791 /branches/PR-7798586:796-799 /branches/PR-7872907:830-840 /branches/PR-7935095:819-821 /branches/PR-8116613:849 /branches/PR-8279204:854-862 /branches/PR-8416637:870-880 /branches/PR-8486662:885-889 /branches/PR-8488185:894-898 /branches/PR-8604911:903-905 /branches/PR-8817822:917-933 /branches/PR-8908468:912 /branches/PR-9697169:1004-1008 /branches/PR-9709247:1002-1009 Modified: trunk/CHANGES =================================================================== --- trunk/CHANGES 2012-03-22 20:26:07 UTC (rev 1031) +++ trunk/CHANGES 2012-03-22 23:33:48 UTC (rev 1032) @@ -1,5 +1,8 @@ Darwin Build Scripts Change History ----------------------------------- +Release 31 [22-Mar-2012] + - darwintrace: fixed crash when used by multi-threaded applications + Release 30 [15-Mar-2012] - darwinup: not detecting installs into /System/Library/Sandbox/Profiles Modified: trunk/darwintrace/darwintrace.c =================================================================== --- trunk/darwintrace/darwintrace.c 2012-03-22 20:26:07 UTC (rev 1031) +++ trunk/darwintrace/darwintrace.c 2012-03-22 23:33:48 UTC (rev 1032) @@ -32,6 +32,7 @@ #include <crt_externs.h> #include <fcntl.h> +#include <pthread.h> #include <spawn.h> #include <stdarg.h> #include <stdio.h> @@ -141,9 +142,7 @@ if (path != test) free(path); } -static inline void darwintrace_setup() { - if (darwintrace_fd != -2) return; - +static void _darwintrace_setup(void) { char* path = getenv("DARWINTRACE_LOG"); if (path != NULL) { int olderrno = errno; @@ -222,6 +221,11 @@ } } +static inline void darwintrace_setup(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, &_darwintrace_setup); +} + /* darwintrace_setup must have been called already */ static inline void darwintrace_logpath(int fd, const char *procname, char *tag, const char *path) { if (darwintrace_ignores) {
participants (1)
-
source_changes@macosforge.org