MCPcopy Create free account
hub / github.com/facebook/SoLoader / fsyncAll

Method fsyncAll

java/com/facebook/soloader/SysUtil.java:328–351  ·  view source on GitHub ↗
(File fileName)

Source from the content-addressed store, hash-verified

326 }
327
328 public static void fsyncAll(File fileName) throws IOException {
329 Stack<File> filesStack = new Stack<>();
330 filesStack.push(fileName);
331 while (!filesStack.isEmpty()) {
332 File currentFile = filesStack.pop();
333 if (currentFile.isDirectory()) {
334 File[] fileList = currentFile.listFiles();
335 if (fileList == null) {
336 throw new IOException("cannot list directory " + currentFile);
337 }
338 for (File entry : fileList) {
339 filesStack.push(entry);
340 }
341 } else if (!currentFile.getPath().endsWith("_lock")) {
342 // Do not sync! Any close(2) of a locked file counts as releasing the file for the whole
343 // process!
344 try (RandomAccessFile file = new RandomAccessFile(currentFile, "r")) {
345 file.getFD().sync();
346 } catch (IOException e) {
347 LogUtil.e(TAG, "Syncing failed for " + currentFile + ": " + e.getMessage());
348 }
349 }
350 }
351 }
352
353 private static long getParcelPadSize(long len) {
354 return len + (4 - (len % 4)) % 4;

Callers 2

runMethod · 0.95

Calls 1

eMethod · 0.95

Tested by

no test coverage detected