2 * (c) The University of Glasgow 2002
4 * Directory Runtime Support
9 // The following is required on Solaris to force the POSIX versions of
10 // the various _r functions instead of the Solaris versions.
11 #ifdef solaris2_TARGET_OS
12 #define _POSIX_PTHREAD_SEMANTICS
17 #if defined(mingw32_TARGET_OS)
22 * read an entry from the directory stream; opt for the
23 * re-entrant friendly way of doing this, if available.
26 __hscore_readdir( HsAddr dirPtr, HsAddr pDirEnt )
28 struct dirent **pDirE = (struct dirent**)pDirEnt;
32 static unsigned int nm_max = -1;
39 nm_max = NAME_MAX + 1;
41 nm_max = pathconf(".", _PC_NAME_MAX);
42 if (nm_max == -1) { nm_max = 255; }
46 p = (struct dirent*)malloc(sizeof(struct dirent) + nm_max);
47 if (p == NULL) return -1;
48 res = readdir_r((DIR*)dirPtr, p, pDirE);
60 *pDirE = readdir((DIR*)dirPtr);