Lines Matching refs:fd
51 int fd = open(path.c_str(), O_RDONLY); in fileGetContents() local
52 if (fd == -1) { in fileGetContents()
58 if (fstat(fd, &statbuf) != 0) { in fileGetContents()
60 close(fd); in fileGetContents()
69 ssize_t numRead = TEMP_FAILURE_RETRY(read(fd, p, remaining)); in fileGetContents()
72 close(fd); in fileGetContents()
78 close(fd); in fileGetContents()
85 int fd; in fileSetContents() local
94 fd = mkstemp(tempName); in fileSetContents()
95 if (fd == -1) { in fileSetContents()
103 ssize_t numWritten = TEMP_FAILURE_RETRY(write(fd, p, remaining)); in fileSetContents()
106 close(fd); in fileSetContents()
113 if (TEMP_FAILURE_RETRY(fsync(fd))) { in fileSetContents()
115 close(fd); in fileSetContents()
118 close(fd); in fileSetContents()
122 close(fd); in fileSetContents()