Lines Matching refs:fd

430 	int fd, err = -1;  in filename__read_build_id()  local
436 fd = open(filename, O_RDONLY); in filename__read_build_id()
437 if (fd < 0) in filename__read_build_id()
440 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in filename__read_build_id()
450 close(fd); in filename__read_build_id()
457 int fd, err = -1; in sysfs__read_build_id() local
462 fd = open(filename, O_RDONLY); in sysfs__read_build_id()
463 if (fd < 0) in sysfs__read_build_id()
471 if (read(fd, &nhdr, sizeof(nhdr)) != sizeof(nhdr)) in sysfs__read_build_id()
478 if (read(fd, bf, namesz) != (ssize_t)namesz) in sysfs__read_build_id()
482 if (read(fd, build_id, sz) == (ssize_t)sz) { in sysfs__read_build_id()
487 } else if (read(fd, bf, descsz) != (ssize_t)descsz) in sysfs__read_build_id()
491 if (read(fd, bf, n) != n) in sysfs__read_build_id()
495 close(fd); in sysfs__read_build_id()
503 int fd, err = -1; in filename__read_debuglink() local
511 fd = open(filename, O_RDONLY); in filename__read_debuglink()
512 if (fd < 0) in filename__read_debuglink()
515 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in filename__read_debuglink()
547 close(fd); in filename__read_debuglink()
582 int fd = -1; in decompress_kmodule() local
597 fd = mkstemp(tmpbuf); in decompress_kmodule()
598 if (fd < 0) { in decompress_kmodule()
603 if (!decompress_to_file(m.ext, name, fd)) { in decompress_kmodule()
605 close(fd); in decompress_kmodule()
606 fd = -1; in decompress_kmodule()
613 return fd; in decompress_kmodule()
630 close(ss->fd); in symsrc__destroy()
644 int fd; in symsrc__init() local
647 fd = decompress_kmodule(dso, name, type); in symsrc__init()
648 if (fd < 0) in symsrc__init()
651 fd = open(name, O_RDONLY); in symsrc__init()
652 if (fd < 0) { in symsrc__init()
658 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in symsrc__init()
730 ss->fd = fd; in symsrc__init()
739 close(fd); in symsrc__init()
1142 int file__read_maps(int fd, bool exe, mapfn_t mapfn, void *data, in file__read_maps() argument
1148 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in file__read_maps()
1161 enum dso_type dso__type_fd(int fd) in dso__type_fd() argument
1168 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in dso__type_fd()
1236 int fd; member
1246 kcore->fd = open(filename, O_RDONLY); in kcore__open()
1247 if (kcore->fd == -1) in kcore__open()
1250 kcore->elf = elf_begin(kcore->fd, ELF_C_READ, NULL); in kcore__open()
1267 close(kcore->fd); in kcore__open()
1277 kcore->fd = mkstemp(filename); in kcore__init()
1279 kcore->fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0400); in kcore__init()
1280 if (kcore->fd == -1) in kcore__init()
1283 kcore->elf = elf_begin(kcore->fd, ELF_C_WRITE, NULL); in kcore__init()
1297 close(kcore->fd); in kcore__init()
1305 close(kcore->fd); in kcore__close()
1702 if (copy_bytes(kcore.fd, kci.kernel_map.offset, extract.fd, offset, in kcore_copy()
1706 if (modules_offset && copy_bytes(kcore.fd, kci.modules_map.offset, in kcore_copy()
1707 extract.fd, modules_offset, in kcore_copy()
1760 if (copy_bytes(kcore.fd, kce->offs, extract.fd, offset, kce->len)) in kcore_extract__create()