summaryrefslogtreecommitdiff
path: root/x11/xproto/patches/patch-Xos_r.h.in
blob: 83b3c8d7e3adb9d07702b399644e57ef70902c89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
$NetBSD: patch-Xos_r.h.in,v 1.1 2013/05/17 13:17:40 joerg Exp $

--- Xos_r.h.in.orig	2013-03-29 23:26:53.000000000 +0000
+++ Xos_r.h.in
@@ -73,13 +73,7 @@ in this Software without prior written a
 # include <X11/Xfuncs.h>
 
 # ifndef X_NOT_POSIX
-#  ifdef _POSIX_SOURCE
-#   include <limits.h>
-#  else
-#   define _POSIX_SOURCE
-#   include <limits.h>
-#   undef _POSIX_SOURCE
-#  endif
+#  include <limits.h>
 #  ifndef LINE_MAX
 #   define X_LINE_MAX 2048
 #  else
@@ -88,6 +82,10 @@ in this Software without prior written a
 # endif
 #endif /* _XOS_R_H */
 
+# ifdef __APPLE__
+#  include <sys/param.h>
+# endif
+
 #ifndef WIN32
 
 #ifdef __cplusplus
@@ -185,6 +183,13 @@ extern void XtProcessUnlock(
 #  endif
 # endif
 
+#undef _XOS_R_H_MTSAFE_DIRENTAPI
+#undef _XOS_R_H_MTSAFE_NETDBAPI
+#undef _XOS_R_H_MTSAFE_PWDAPI
+#undef _XOS_R_H_MTSAFE_UNISTDAPI
+#undef _XOS_R_H_MTSAFE_STRINGAPI
+#undef _XOS_R_H_MTSAFE_TIMEAPI
+#undef _XOS_R_H_MTSAFE_GRPAPI
 #endif /* !defined WIN32 */
 
 /*
@@ -214,7 +219,7 @@ extern void XtProcessUnlock(
 
 #if defined(X_INCLUDE_PWD_H) && !defined(_XOS_INCLUDED_PWD_H)
 # include <pwd.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_PWDAPI)
+# if defined(_XOS_R_H_MTSAFE_PWDAPI)
 #  define XOS_USE_MTSAFE_PWDAPI 1
 # endif
 #endif
@@ -318,7 +323,7 @@ static __inline__ void _Xpw_copyPasswd(_
   (_Xos_processUnlock), \
   (p).pwp )
 
-#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__)
+#elif !defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(__APPLE__) && !defined(__NetBSD__) && !defined(__DragonFly__)
 # define X_NEEDS_PWPARAMS
 typedef struct {
   struct passwd pws;
@@ -384,7 +389,7 @@ typedef int _Xgetpwret;
 #if defined(X_INCLUDE_NETDB_H) && !defined(_XOS_INCLUDED_NETDB_H) \
     && !defined(WIN32)
 # include <netdb.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_NETDBAPI)
+# if defined(_XOS_R_H_MTSAFE_NETDBAPI)
 #  define XOS_USE_MTSAFE_NETDBAPI 1
 # endif
 #endif
@@ -543,7 +548,7 @@ typedef int _Xgetservbynameparams; /* du
 #   define dirent direct
 #  endif
 # endif
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_DIRENTAPI)
+# if defined(_XOS_R_H_MTSAFE_DIRENTAPI)
 #  define XOS_USE_MTSAFE_DIRENTAPI 1
 # endif
 #endif
@@ -604,15 +609,8 @@ typedef struct {
 /* Pre-POSIX API, returns non-NULL on success. */
 #  define _XReaddir(d,p)	(readdir_r((d), &(p).dir_entry))
 # else
-/* We have no idea what is going on.  Fake it all using process locks. */
-#  define _XReaddir(d,p)	\
-    ( (_Xos_processLock),						\
-      (((p).result = readdir((d))) ?					\
-       (memcpy(&((p).dir_entry), (p).result, (p).result->d_reclen),	\
-	((p).result = &(p).dir_entry), 0) :				\
-       0),								\
-      (_Xos_processUnlock),						\
-      (p).result )
+#  define _XReaddir(d,p)						\
+    (readdir_r((d), &((p).dir_entry), &((p).result)) ? NULL : (p).result)
 # endif
 #endif /* X_INCLUDE_DIRENT_H */
 
@@ -639,7 +637,7 @@ typedef struct {
 
 #if defined(X_INCLUDE_UNISTD_H) && !defined(_XOS_INCLUDED_UNISTD_H)
 /* <unistd.h> already included by <X11/Xos.h> */
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_UNISTDAPI)
+# if defined(_XOS_R_H__MTSAFE_UNISTDAPI)
 #  define XOS_USE_MTSAFE_UNISTDAPI 1
 # endif
 #endif
@@ -779,7 +777,7 @@ typedef struct {
 
 #if defined(X_INCLUDE_STRING_H) && !defined(_XOS_INCLUDED_STRING_H)
 /* <string.h> has already been included by <X11/Xos.h> */
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_STRINGAPI)
+# if defined(_XOS_R_H_MTSAFE_STRINGAPI)
 #  define XOS_USE_MTSAFE_STRINGAPI 1
 # endif
 #endif
@@ -831,7 +829,7 @@ typedef char * _Xstrtokparams;
 
 #if defined(X_INCLUDE_TIME_H) && !defined(_XOS_INCLUDED_TIME_H)
 # include <time.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_TIMEAPI)
+# if defined(_XOS_R_H_MTSAFE_TIMEAPI)
 #  define XOS_USE_MTSAFE_TIMEAPI 1
 # endif
 #endif
@@ -987,7 +985,7 @@ typedef struct tm _Xltimeparams;
 
 #if defined(X_INCLUDE_GRP_H) && !defined(_XOS_INCLUDED_GRP_H)
 # include <grp.h>
-# if defined(XUSE_MTSAFE_API) || defined(XUSE_MTSAFE_GRPAPI)
+# if defined(_XOS_R_H_MTSAFE_GRPAPI)
 #  define XOS_USE_MTSAFE_GRPAPI 1
 # endif
 #endif