File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1717
1818/* mp-safe wrappers for malloc, etc. */
1919
20+ #ifdef TARGET_LINUX
21+ #include <features.h>
22+ #endif
23+
2024#include <stdlib.h>
2125#include "llcrit.h"
26+ #ifndef __GNU_LIBRARY__
2227MP_SEMAPHORE (static , sem );
28+ #endif
2329
2430void *
2531_mp_malloc (size_t n )
2632{
2733 void * p ;
2834
35+ #ifndef __GNU_LIBRARY__
2936 _mp_p (& sem );
37+ #endif
3038 p = malloc (n );
39+ #ifndef __GNU_LIBRARY__
3140 _mp_v (& sem );
41+ #endif
3242 return (p );
3343}
3444
@@ -37,9 +47,13 @@ _mp_calloc(size_t n, size_t t)
3747{
3848 void * p ;
3949
50+ #ifndef __GNU_LIBRARY__
4051 _mp_p (& sem );
52+ #endif
4153 p = calloc (n , t );
54+ #ifndef __GNU_LIBRARY__
4255 _mp_v (& sem );
56+ #endif
4357 return (p );
4458}
4559
@@ -48,9 +62,13 @@ _mp_realloc(void *p, size_t n)
4862{
4963 void * q ;
5064
65+ #ifndef __GNU_LIBRARY__
5166 _mp_p (& sem );
67+ #endif
5268 q = realloc (p , n );
69+ #ifndef __GNU_LIBRARY__
5370 _mp_v (& sem );
71+ #endif
5472 return (q );
5573}
5674
@@ -59,7 +77,11 @@ _mp_free(void *p)
5977{
6078 if (p == 0 )
6179 return ;
80+ #ifndef __GNU_LIBRARY__
6281 _mp_p (& sem );
82+ #endif
6383 free (p );
84+ #ifndef __GNU_LIBRARY__
6485 _mp_v (& sem );
86+ #endif
6587}
You can’t perform that action at this time.
0 commit comments