Lines Matching refs:fd
205 int fd; in map_file() local
207 fd = open(file_name, O_RDWR); in map_file()
208 if (fd < 0) { in map_file()
212 if (fstat(fd, &st)) { in map_file()
214 close(fd); in map_file()
218 map = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); in map_file()
221 close(fd); in map_file()
224 close(fd); in map_file()
232 int fd; in read_file() local
234 fd = open(file_name, O_RDONLY); in read_file()
235 if (fd < 0) { in read_file()
239 if (fstat(fd, &st)) { in read_file()
241 close(fd); in read_file()
248 close(fd); in read_file()
251 if (read(fd, buf, *size) != *size) { in read_file()
253 close(fd); in read_file()
256 close(fd); in read_file()