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
|
$NetBSD: patch-bc,v 1.2 2005/12/12 19:52:17 joerg Exp $
--- include/Xos_r.h.orig 2005-12-12 19:16:02.000000000 +0000
+++ include/Xos_r.h
@@ -205,6 +205,9 @@ extern void XtProcessUnlock(
# undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif
+#if defined(__DragonFly__)
+#define XNO_MTSAFE_PWDAPI 1
+#endif
/***** <pwd.h> wrappers *****/
@@ -257,7 +260,7 @@ typedef struct {
*/
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
- defined(__APPLE__)
+ defined(__APPLE__) || defined(__DragonFly__)
static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
{
memcpy(&(p).pws, (p).pwp, sizeof(struct passwd));
@@ -427,7 +430,7 @@ typedef int _Xgetservbynameparams; /* du
/* UnixWare 2.0, or other systems with thread support but no _r API. */
/* WARNING: The h_addr_list and s_aliases values are *not* copied! */
-#if defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/param.h>
#endif
@@ -652,6 +655,15 @@ extern int _Preaddir_r(DIR *, struct dir
# elif defined(SVR4)
/* Pre-POSIX API, returns non-NULL on success. */
# define _XReaddir(d,p) (readdir_r((d), &(p).dir_entry))
+#elif defined(__DragonFly__)
+# define _XReaddir(d,p) \
+ ( (_Xos_processLock), \
+ (((p).result = readdir((d))) ? \
+ (memcpy(&((p).dir_entry), (p).result, _DIRENT_MINSIZ((p).result)), \
+ ((p).result = &(p).dir_entry), 0) : \
+ 0), \
+ (_Xos_processUnlock), \
+ (p).result )
# else
/* We have no idea what is going on. Fake it all using process locks. */
# define _XReaddir(d,p) \
|