annotate patches/nspr-static.patch @ 4:b513267f632f tip

Build DBM module
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 05 Aug 2014 18:58:03 +0200
parents 1e5118fa0cb1
children
rev   line source
0
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 Index: mozilla/nsprpub/pr/include/prtypes.h
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 ===================================================================
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 RCS file: /cvsroot/mozilla/nsprpub/pr/include/prtypes.h,v
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 retrieving revision 3.52
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 diff -p -u -8 -r3.52 prtypes.h
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 --- mozilla/nsprpub/pr/include/prtypes.h 7 Dec 2012 21:13:41 -0000 3.52
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 +++ mozilla/nsprpub/pr/include/prtypes.h 29 Jan 2013 01:15:02 -0000
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 @@ -43,17 +43,33 @@
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 ** Example:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 ** in dowhim.h
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 ** PR_EXTERN( void ) DoWhatIMean( void );
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 ** in dowhim.c
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13 ** PR_IMPLEMENT( void ) DoWhatIMean( void ) { return; }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 **
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 **
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16 ***********************************************************************/
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 -#if defined(WIN32)
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 +#if defined(NSPR_STATIC)
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 +#define PR_EXPORT(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 +#define PR_EXPORT_DATA(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 +#define PR_IMPORT(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 +#define PR_IMPORT_DATA(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25 +#define PR_EXTERN(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 +#define PR_IMPLEMENT(__type) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 +#define PR_EXTERN_DATA(__type) extern __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 +#define PR_IMPLEMENT_DATA(__type) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
30 +#define PR_CALLBACK
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
31 +#define PR_CALLBACK_DECL
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32 +#define PR_STATIC_CALLBACK(__x) static __x
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34 +#elif defined(WIN32)
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 #define PR_EXPORT(__type) extern __declspec(dllexport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37 #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38 #define PR_IMPORT(__type) __declspec(dllimport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 #define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 #define PR_EXTERN(__type) extern __declspec(dllexport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 #define PR_IMPLEMENT(__type) __declspec(dllexport) __type
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 Index: mozilla/nsprpub/pr/src/md/windows/w95dllmain.c
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 ===================================================================
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 RCS file: /cvsroot/mozilla/nsprpub/pr/src/md/windows/w95dllmain.c,v
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 retrieving revision 3.9
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 diff -p -u -8 -r3.9 w95dllmain.c
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 --- mozilla/nsprpub/pr/src/md/windows/w95dllmain.c 6 Mar 2012 13:14:17 -0000 3.9
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49 +++ mozilla/nsprpub/pr/src/md/windows/w95dllmain.c 29 Jan 2013 01:15:02 -0000
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 @@ -1,13 +1,15 @@
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 /* This Source Code Form is subject to the terms of the Mozilla Public
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53 * License, v. 2.0. If a copy of the MPL was not distributed with this
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
56 +#ifndef NSPR_STATIC /* See the end of w95thred.c. */
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
57 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
58 /*
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
59 * The DLL entry point (DllMain) for NSPR.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
60 *
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
61 * This is used to detach threads that were automatically attached by
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
62 * nspr.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
63 */
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65 #include <windows.h>
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 @@ -32,8 +34,10 @@ PRThread *me;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 _PRI_DetachThread();
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68 }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69 break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
70 case DLL_PROCESS_DETACH:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
71 break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
72 }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
73 return TRUE;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74 }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
75 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
76 +#endif
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
77 Index: mozilla/nsprpub/pr/src/md/windows/w95thred.c
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
78 ===================================================================
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
79 RCS file: /cvsroot/mozilla/nsprpub/pr/src/md/windows/w95thred.c,v
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
80 retrieving revision 3.22
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
81 diff -p -u -8 -r3.22 w95thred.c
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
82 --- mozilla/nsprpub/pr/src/md/windows/w95thred.c 13 Jun 2012 02:17:05 -0000 3.22
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
83 +++ mozilla/nsprpub/pr/src/md/windows/w95thred.c 29 Jan 2013 01:15:02 -0000
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
84 @@ -313,8 +313,125 @@ PRThread *thread;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
85
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
86 if (NULL == thread) {
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
87 thread = _PRI_AttachThread(
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
88 PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL, 0);
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
89 }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
90 PR_ASSERT(thread != NULL);
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
91 return thread;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
92 }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
93 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
94 +#ifdef NSPR_STATIC
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
95 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
96 +// The following code is from Chromium src/base/thread_local_storage_win.cc,
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
97 +// r11329.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
98 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
99 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
100 +//
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
101 +// Redistribution and use in source and binary forms, with or without
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
102 +// modification, are permitted provided that the following conditions are
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
103 +// met:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
104 +//
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
105 +// * Redistributions of source code must retain the above copyright
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
106 +// notice, this list of conditions and the following disclaimer.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
107 +// * Redistributions in binary form must reproduce the above
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
108 +// copyright notice, this list of conditions and the following disclaimer
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
109 +// in the documentation and/or other materials provided with the
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
110 +// distribution.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
111 +// * Neither the name of Google Inc. nor the names of its
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
112 +// contributors may be used to endorse or promote products derived from
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
113 +// this software without specific prior written permission.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
114 +//
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
115 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
116 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
117 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
118 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
119 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
120 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
121 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
122 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
123 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
124 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
125 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
126 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
127 +// Thread Termination Callbacks.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
128 +// Windows doesn't support a per-thread destructor with its
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
129 +// TLS primitives. So, we build it manually by inserting a
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
130 +// function to be called on each thread's exit.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
131 +// This magic is from http://www.codeproject.com/threads/tls.asp
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
132 +// and it works for VC++ 7.0 and later.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
133 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
134 +// Force a reference to _tls_used to make the linker create the TLS directory
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
135 +// if it's not already there. (e.g. if __declspec(thread) is not used).
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
136 +// Force a reference to p_thread_callback_nspr to prevent whole program
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
137 +// optimization from discarding the variable.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
138 +#ifdef _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
139 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
140 +#pragma comment(linker, "/INCLUDE:_tls_used")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
141 +#pragma comment(linker, "/INCLUDE:p_thread_callback_nspr")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
142 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
143 +#else // _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
144 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
145 +#pragma comment(linker, "/INCLUDE:__tls_used")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
146 +#pragma comment(linker, "/INCLUDE:_p_thread_callback_nspr")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
147 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
148 +#endif // _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
149 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
150 +// Static callback function to call with each thread termination.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
151 +static void NTAPI PR_OnThreadExit(PVOID module, DWORD reason, PVOID reserved)
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
152 +{
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
153 +PRThread *me;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
154 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
155 + switch (reason) {
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
156 + case DLL_PROCESS_ATTACH:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
157 + break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
158 + case DLL_THREAD_ATTACH:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
159 + break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
160 + case DLL_THREAD_DETACH:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
161 + if (_pr_initialized) {
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
162 + me = _MD_GET_ATTACHED_THREAD();
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
163 + if ((me != NULL) && (me->flags & _PR_ATTACHED))
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
164 + _PRI_DetachThread();
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
165 + }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
166 + break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
167 + case DLL_PROCESS_DETACH:
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
168 + break;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
169 + }
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
170 +}
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
171 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
172 +// .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK pointers that are
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
173 +// called automatically by the OS loader code (not the CRT) when the module is
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
174 +// loaded and on thread creation. They are NOT called if the module has been
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
175 +// loaded by a LoadLibrary() call. It must have implicitly been loaded at
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
176 +// process startup.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
177 +// By implicitly loaded, I mean that it is directly referenced by the main EXE
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
178 +// or by one of its dependent DLLs. Delay-loaded DLL doesn't count as being
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
179 +// implicitly loaded.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
180 +//
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
181 +// See VC\crt\src\tlssup.c for reference.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
182 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
183 +// The linker must not discard p_thread_callback_nspr. (We force a reference
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
184 +// to this variable with a linker /INCLUDE:symbol pragma to ensure that.) If
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
185 +// this variable is discarded, the PR_OnThreadExit function will never be
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
186 +// called.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
187 +#ifdef _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
188 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
189 +// .CRT section is merged with .rdata on x64 so it must be constant data.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
190 +#pragma const_seg(".CRT$XLB")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
191 +// When defining a const variable, it must have external linkage to be sure the
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
192 +// linker doesn't discard it.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
193 +extern const PIMAGE_TLS_CALLBACK p_thread_callback_nspr;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
194 +const PIMAGE_TLS_CALLBACK p_thread_callback_nspr = PR_OnThreadExit;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
195 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
196 +// Reset the default section.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
197 +#pragma const_seg()
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
198 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
199 +#else // _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
200 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
201 +#pragma data_seg(".CRT$XLB")
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
202 +PIMAGE_TLS_CALLBACK p_thread_callback_nspr = PR_OnThreadExit;
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
203 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
204 +// Reset the default section.
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
205 +#pragma data_seg()
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
206 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
207 +#endif // _WIN64
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
208 +
1e5118fa0cb1 This is NSS with a Cmake Buildsyste
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
209 +#endif // NSPR_STATIC
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)