Changeset 28688 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Apr 24, 2010 6:12:55 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/dir.cpp
r27246 r28688 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 44 44 #include <iprt/dir.h> 45 #include "internal/iprt.h" 46 47 #include <iprt/assert.h> 45 48 #include <iprt/file.h> 49 #include <iprt/err.h> 50 #include <iprt/log.h> 51 #include <iprt/mem.h> 52 #include <iprt/param.h> 46 53 #include <iprt/path.h> 47 #include <iprt/alloc.h>48 #include <iprt/log.h>49 #include <iprt/param.h>50 54 #include <iprt/string.h> 51 #include <iprt/err.h>52 #include <iprt/assert.h>53 55 #include <iprt/uni.h> 54 56 #include "internal/dir.h" … … 865 867 } 866 868 869 870 RTDECL(int) RTDirFlushParent(const char *pszChild) 871 { 872 char szPath[RTPATH_MAX]; 873 int rc = RTStrCopy(szPath, sizeof(szPath), pszChild); 874 if (RT_SUCCESS(rc)) 875 { 876 RTPathStripFilename(szPath); 877 rc = RTDirFlush(szPath); 878 } 879 return rc; 880 } 881 -
trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp
r25292 r28688 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Sun Microsystems, Inc.7 * Copyright (C) 2006-2010 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 #include <sys/types.h> 39 39 #include <sys/stat.h> 40 #include <sys/fcntl.h> 41 #include <fcntl.h> 40 42 #include <dirent.h> 41 43 #include <stdio.h> 42 44 43 45 #include <iprt/dir.h> 44 #include <iprt/path.h>45 #include <iprt/alloc.h> 46 #include "internal/iprt.h" 47 46 48 #include <iprt/alloca.h> 47 #include <iprt/string.h>48 49 #include <iprt/assert.h> 49 50 #include <iprt/err.h> 50 51 #include <iprt/log.h> 52 #include <iprt/mem.h> 53 #include <iprt/param.h> 54 #include <iprt/path.h> 55 #include <iprt/string.h> 51 56 #include "internal/dir.h" 52 57 #include "internal/fs.h" … … 134 139 135 140 LogFlow(("RTDirRemove(%p={%s}): returns %Rrc\n", pszPath, pszPath, rc)); 141 return rc; 142 } 143 144 145 RTDECL(int) RTDirFlush(const char *pszPath) 146 { 147 /* 148 * Linux: The fsync() man page hints at this being required for ensuring 149 * consistency between directory and file in case of a crash. 150 * 151 * Solaris: No mentioned is made of directories on the fsync man page. 152 * While rename+fsync will do what we want on ZFS, the code needs more 153 * careful studying wrt whether the directory entry of a new file is 154 * implicitly synced when the file is synced (it's very likely for ZFS). 155 * 156 * FreeBSD: The FFS fsync code seems to flush the directory entry as well 157 * in some cases. Don't know exactly what's up with rename, but from the 158 * look of things fsync(dir) should work. 159 */ 160 int rc; 161 int fd = open(pszPath, O_DIRECTORY | O_RDONLY, 0); 162 if (fd >= 0) 163 { 164 if (fsync(fd) == 0) 165 rc = VINF_SUCCESS; 166 else 167 rc = RTErrConvertFromErrno(errno); 168 close(fd); 169 } 170 else 171 rc = RTErrConvertFromErrno(errno); 136 172 return rc; 137 173 } -
trunk/src/VBox/Runtime/r3/win/dir-win.cpp
r25292 r28688 128 128 129 129 130 RTDECL(int) RTDirFlush(const char *pszPath) 131 { 132 return VERR_NOT_SUPPORTED; 133 } 134 135 130 136 int rtOpenDirNative(PRTDIR pDir, char *pszPathBuf) 131 137 {
Note:
See TracChangeset
for help on using the changeset viewer.