Lines Matching refs:fd
35 int fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)); in open_idmap() local
36 if (fd == -1) { in open_idmap()
40 if (fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0) { in open_idmap()
44 if (TEMP_FAILURE_RETRY(flock(fd, LOCK_EX)) != 0) { in open_idmap()
49 return fd; in open_idmap()
51 if (fd != -1) { in open_idmap()
52 close(fd); in open_idmap()
58 int write_idmap(int fd, const uint32_t *data, size_t size) in write_idmap() argument
60 if (lseek(fd, 0, SEEK_SET) < 0) { in write_idmap()
65 ssize_t w = TEMP_FAILURE_RETRY(write(fd, data + size - bytesLeft, bytesLeft)); in write_idmap()
176 int fd, bool check_if_stale) in create_and_write_idmap() argument
179 if (!is_idmap_stale_fd(target_apk_path, overlay_apk_path, fd)) { in create_and_write_idmap()
192 if (write_idmap(fd, data, size) == -1) { in create_and_write_idmap()
210 int fd = open_idmap(idmap_path); in idmap_create_path() local
211 if (fd == -1) { in idmap_create_path()
215 int r = create_and_write_idmap(target_apk_path, overlay_apk_path, fd, false); in idmap_create_path()
216 close(fd); in idmap_create_path()
223 int idmap_create_fd(const char *target_apk_path, const char *overlay_apk_path, int fd) in idmap_create_fd() argument
225 return create_and_write_idmap(target_apk_path, overlay_apk_path, fd, true) == 0 ? in idmap_create_fd()
229 int idmap_verify_fd(const char *target_apk_path, const char *overlay_apk_path, int fd) in idmap_verify_fd() argument
231 return !is_idmap_stale_fd(target_apk_path, overlay_apk_path, fd) ? in idmap_verify_fd()