Changeset 101935 in vbox for trunk/src/libs/xpcom18a4/nsprpub/pr
- Timestamp:
- Nov 7, 2023 11:49:26 AM (15 months ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/prio.h
r101930 r101935 72 72 #define PR_Listen VBoxNsprPR_Listen 73 73 #define PR_Accept VBoxNsprPR_Accept 74 #define PR_OpenDir VBoxNsprPR_OpenDir75 #define PR_ReadDir VBoxNsprPR_ReadDir76 #define PR_CloseDir VBoxNsprPR_CloseDir77 74 #define PR_CreatePipe VBoxNsprPR_CreatePipe 78 75 #define PR_GetDescType VBoxNsprPR_GetDescType … … 962 959 NSPR_API(PRStatus) PR_Sync(PRFileDesc *fd); 963 960 964 /************************************************************************/965 966 struct PRDirEntry {967 const char *name; /* name of entry, relative to directory name */968 };969 970 #if !defined(NO_NSPR_10_SUPPORT)971 #define PR_DirName(dirEntry) (dirEntry->name)972 #endif973 974 /*975 *************************************************************************976 * FUNCTION: PR_OpenDir977 * DESCRIPTION:978 * Open the directory by the given name979 * INPUTS:980 * const char *name981 * path name of the directory to be opened982 * OUTPUTS:983 * None984 * RETURN: PRDir *985 * If the directory is sucessfully opened, a PRDir object is986 * dynamically allocated and a pointer to it is returned.987 * If the directory cannot be opened, a NULL pointer is returned.988 * MEMORY:989 * Upon successful completion, the return value points to990 * dynamically allocated memory.991 *************************************************************************992 */993 994 NSPR_API(PRDir*) PR_OpenDir(const char *name);995 996 /*997 *************************************************************************998 * FUNCTION: PR_ReadDir999 * DESCRIPTION:1000 * INPUTS:1001 * PRDir *dir1002 * pointer to a PRDir object that designates an open directory1003 * PRDirFlags flags1004 * PR_SKIP_NONE Do not skip any files1005 * PR_SKIP_DOT Skip the directory entry "." that1006 * represents the current directory1007 * PR_SKIP_DOT_DOT Skip the directory entry ".." that1008 * represents the parent directory.1009 * PR_SKIP_BOTH Skip both '.' and '..'1010 * PR_SKIP_HIDDEN Skip hidden files1011 * OUTPUTS:1012 * RETURN: PRDirEntry*1013 * Returns a pointer to the next entry in the directory. Returns1014 * a NULL pointer upon reaching the end of the directory or when an1015 * error occurs. The actual reason can be retrieved via PR_GetError().1016 *************************************************************************1017 */1018 1019 typedef enum PRDirFlags {1020 PR_SKIP_NONE = 0x0,1021 PR_SKIP_DOT = 0x1,1022 PR_SKIP_DOT_DOT = 0x2,1023 PR_SKIP_BOTH = 0x3,1024 PR_SKIP_HIDDEN = 0x41025 } PRDirFlags;1026 1027 NSPR_API(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags);1028 1029 /*1030 *************************************************************************1031 * FUNCTION: PR_CloseDir1032 * DESCRIPTION:1033 * Close the specified directory.1034 * INPUTS:1035 * PRDir *dir1036 * The directory to be closed.1037 * OUTPUTS:1038 * None1039 * RETURN: PRStatus1040 * If successful, will return a status of PR_SUCCESS. Otherwise1041 * a value of PR_FAILURE. The reason for the failure may be re-1042 * trieved using PR_GetError().1043 *************************************************************************1044 */1045 1046 NSPR_API(PRStatus) PR_CloseDir(PRDir *dir);1047 1048 961 /* 1049 962 ************************************************************************* -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r101905 r101935 499 499 * the address family of the socket. */ 500 500 #endif 501 };502 503 struct PRDir {504 PRDirEntry d;505 _MDDir md;506 501 }; 507 502 -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
r101930 r101935 2099 2099 return (0 == rv) ? PR_SUCCESS : PR_FAILURE; 2100 2100 } /* PR_GetFileInfo64 */ 2101 2102 PR_IMPLEMENT(PRStatus) PR_CloseDir(PRDir *dir)2103 {2104 if (pt_TestAbort()) return PR_FAILURE;2105 2106 if (NULL != dir->md.d)2107 {2108 if (closedir(dir->md.d) == -1)2109 {2110 _PR_MD_MAP_CLOSEDIR_ERROR(errno);2111 return PR_FAILURE;2112 }2113 dir->md.d = NULL;2114 PR_DELETE(dir);2115 }2116 return PR_SUCCESS;2117 } /* PR_CloseDir */2118 2119 PR_IMPLEMENT(PRDir*) PR_OpenDir(const char *name)2120 {2121 DIR *osdir;2122 PRDir *dir = NULL;2123 2124 if (pt_TestAbort()) return dir;2125 2126 osdir = opendir(name);2127 if (osdir == NULL)2128 pt_MapError(_PR_MD_MAP_OPENDIR_ERROR, errno);2129 else2130 {2131 dir = PR_NEWZAP(PRDir);2132 dir->md.d = osdir;2133 }2134 return dir;2135 } /* PR_OpenDir */2136 2101 2137 2102 static PRInt32 _pr_poll_with_poll( … … 2388 2353 } 2389 2354 2390 PR_IMPLEMENT(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags)2391 {2392 struct dirent *dp;2393 2394 if (pt_TestAbort()) return NULL;2395 2396 for (;;)2397 {2398 dp = readdir(dir->md.d);2399 if (NULL == dp) return NULL;2400 if ((flags & PR_SKIP_DOT)2401 && ('.' == dp->d_name[0])2402 && (0 == dp->d_name[1])) continue;2403 if ((flags & PR_SKIP_DOT_DOT)2404 && ('.' == dp->d_name[0])2405 && ('.' == dp->d_name[1])2406 && (0 == dp->d_name[2])) continue;2407 if ((flags & PR_SKIP_HIDDEN) && ('.' == dp->d_name[0]))2408 continue;2409 break;2410 }2411 dir->d.name = dp->d_name;2412 return &dir->d;2413 } /* PR_ReadDir */2414 2415 2355 PR_IMPLEMENT(PRFileDesc*) PR_OpenTCPSocket(PRIntn af) 2416 2356 {
Note:
See TracChangeset
for help on using the changeset viewer.