• Home
  • Raw
  • Download

Lines Matching refs:fd

57 static int writeDependencies(int fd, u4 modWhen, u4 crc);
58 static bool writeOptData(int fd, const DexClassLookup* pClassLookup,\
60 static bool computeFileChecksum(int fd, off_t start, size_t length, u4* pSum);
132 int fd, cc; in dvmOpenCachedDexFile() local
143 fd = createIfMissing ? open(cacheFileName, O_CREAT|O_RDWR, 0644) : -1; in dvmOpenCachedDexFile()
144 if (fd < 0) { in dvmOpenCachedDexFile()
145 fd = open(cacheFileName, O_RDONLY, 0); in dvmOpenCachedDexFile()
146 if (fd < 0) { in dvmOpenCachedDexFile()
154 return fd; in dvmOpenCachedDexFile()
158 fchmod(fd, 0644); in dvmOpenCachedDexFile()
167 cacheFileName, fd, isBootstrap); in dvmOpenCachedDexFile()
169 cc = flock(fd, LOCK_EX | LOCK_NB); in dvmOpenCachedDexFile()
172 cc = flock(fd, LOCK_EX); in dvmOpenCachedDexFile()
177 close(fd); in dvmOpenCachedDexFile()
189 cc = fstat(fd, &fdStat); in dvmOpenCachedDexFile()
201 flock(fd, LOCK_UN); in dvmOpenCachedDexFile()
202 close(fd); in dvmOpenCachedDexFile()
219 cc = dexOptCreateEmptyHeader(fd); in dvmOpenCachedDexFile()
247 if (!dvmCheckOptHeaderAndDependencies(fd, true, modWhen, crc, in dvmOpenCachedDexFile()
287 if (ftruncate(fd, 0) != 0) { in dvmOpenCachedDexFile()
298 flock(fd, LOCK_UN); in dvmOpenCachedDexFile()
299 close(fd); in dvmOpenCachedDexFile()
306 assert(fd >= 0); in dvmOpenCachedDexFile()
307 return fd; in dvmOpenCachedDexFile()
310 flock(fd, LOCK_UN); in dvmOpenCachedDexFile()
311 close(fd); in dvmOpenCachedDexFile()
320 bool dvmUnlockCachedDexFile(int fd) in dvmUnlockCachedDexFile() argument
322 LOGVV("DexOpt: unlocking cache file fd=%d", fd); in dvmUnlockCachedDexFile()
323 return (flock(fd, LOCK_UN) == 0); in dvmUnlockCachedDexFile()
351 bool dvmOptimizeDexFile(int fd, off_t dexOffset, long dexLength, in dvmOptimizeDexFile() argument
424 sprintf(values[3], "%d", fd); in dvmOptimizeDexFile()
527 bool dvmContinueOptimization(int fd, off_t dexOffset, long dexLength, in dvmContinueOptimization() argument
567 MAP_SHARED, fd, 0); in dvmContinueOptimization()
660 depsOffset = lseek(fd, 0, SEEK_END); in dvmContinueOptimization()
670 lseek(fd, depsOffset, SEEK_SET); in dvmContinueOptimization()
676 if (writeDependencies(fd, modWhen, crc) != 0) { in dvmContinueOptimization()
682 optOffset = lseek(fd, 0, SEEK_END); in dvmContinueOptimization()
690 lseek(fd, optOffset, SEEK_SET); in dvmContinueOptimization()
696 if (!writeOptData(fd, pClassLookup, pRegMapBuilder)) { in dvmContinueOptimization()
701 endOffset = lseek(fd, 0, SEEK_END); in dvmContinueOptimization()
705 if (!computeFileChecksum(fd, depsOffset, in dvmContinueOptimization()
732 fsync(fd); /* ensure previous writes go before header is written */ in dvmContinueOptimization()
734 lseek(fd, 0, SEEK_SET); in dvmContinueOptimization()
735 if (sysWriteFully(fd, &optHdr, sizeof(optHdr), "DexOpt opt header") != 0) in dvmContinueOptimization()
1170 bool dvmCheckOptHeaderAndDependencies(int fd, bool sourceAvail, u4 modWhen, in dvmCheckOptHeaderAndDependencies() argument
1184 if (lseek(fd, 0, SEEK_SET) != 0) { in dvmCheckOptHeaderAndDependencies()
1193 actual = read(fd, &optHdr, sizeof(optHdr)); in dvmCheckOptHeaderAndDependencies()
1242 posn = lseek(fd, optHdr.depsOffset, SEEK_SET); in dvmCheckOptHeaderAndDependencies()
1257 actual = read(fd, depData, optHdr.depsLength); in dvmCheckOptHeaderAndDependencies()
1361 static int writeDependencies(int fd, u4 modWhen, u4 crc) in writeDependencies() argument
1422 result = sysWriteFully(fd, buf, bufLen, "DexOpt dep info"); in writeDependencies()
1435 static bool writeChunk(int fd, u4 type, const void* data, size_t size) in writeChunk() argument
1451 if (sysWriteFully(fd, &header, sizeof(header), in writeChunk()
1458 if (sysWriteFully(fd, data, size, "DexOpt opt chunk write") != 0) in writeChunk()
1466 lseek(fd, padSize, SEEK_CUR); in writeChunk()
1469 assert( ((int)lseek(fd, 0, SEEK_CUR) & 7) == 0); in writeChunk()
1482 static bool writeOptData(int fd, const DexClassLookup* pClassLookup, in writeOptData() argument
1486 if (!writeChunk(fd, (u4) kDexChunkClassLookup, in writeOptData()
1494 if (!writeChunk(fd, (u4) kDexChunkRegisterMaps, in writeOptData()
1502 if (!writeChunk(fd, (u4) kDexChunkEnd, NULL, 0)) { in writeOptData()
1516 static bool computeFileChecksum(int fd, off_t start, size_t length, u4* pSum) in computeFileChecksum() argument
1522 if (lseek(fd, start, SEEK_SET) != start) { in computeFileChecksum()
1532 actual = read(fd, readBuf, wanted); in computeFileChecksum()