/tools/testing/selftests/memfd/ |
D | memfd_test.c | 31 int r, fd; in mfd_assert_new() local 33 fd = sys_memfd_create(name, flags); in mfd_assert_new() 34 if (fd < 0) { in mfd_assert_new() 40 r = ftruncate(fd, sz); in mfd_assert_new() 46 return fd; in mfd_assert_new() 62 static unsigned int mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument 66 r = fcntl(fd, F_GET_SEALS); in mfd_assert_get_seals() 68 printf("GET_SEALS(%d) failed: %m\n", fd); in mfd_assert_get_seals() 75 static void mfd_assert_has_seals(int fd, unsigned int seals) in mfd_assert_has_seals() argument 79 s = mfd_assert_get_seals(fd); in mfd_assert_has_seals() [all …]
|
D | fuse_test.c | 46 int r, fd; in mfd_assert_new() local 48 fd = sys_memfd_create(name, flags); in mfd_assert_new() 49 if (fd < 0) { in mfd_assert_new() 55 r = ftruncate(fd, sz); in mfd_assert_new() 61 return fd; in mfd_assert_new() 64 static __u64 mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument 68 r = fcntl(fd, F_GET_SEALS); in mfd_assert_get_seals() 70 printf("GET_SEALS(%d) failed: %m\n", fd); in mfd_assert_get_seals() 77 static void mfd_assert_has_seals(int fd, __u64 seals) in mfd_assert_has_seals() argument 81 s = mfd_assert_get_seals(fd); in mfd_assert_has_seals() [all …]
|
/tools/testing/selftests/efivarfs/ |
D | open-unlink.c | 15 int fd; in set_immutable() local 19 fd = open(path, O_RDONLY); in set_immutable() 20 if (fd < 0) in set_immutable() 21 return fd; in set_immutable() 23 rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); in set_immutable() 26 close(fd); in set_immutable() 36 rc = ioctl(fd, FS_IOC_SETFLAGS, &flags); in set_immutable() 38 close(fd); in set_immutable() 46 int fd; in get_immutable() local 50 fd = open(path, O_RDONLY); in get_immutable() [all …]
|
/tools/perf/util/ |
D | data.c | 16 int fd = perf_data_file__is_read(file) ? in check_pipe() local 20 if (!fstat(fd, &st) && S_ISFIFO(st.st_mode)) in check_pipe() 28 file->fd = fd; in check_pipe() 52 int fd; in open_file_read() local 55 fd = open(file->path, O_RDONLY); in open_file_read() 56 if (fd < 0) { in open_file_read() 67 if (fstat(fd, &st) < 0) in open_file_read() 83 return fd; in open_file_read() 86 close(fd); in open_file_read() 92 int fd; in open_file_write() local [all …]
|
D | cloexec.c | 24 int fd; in perf_flag_probe() local 40 fd = sys_perf_event_open(&attr, pid, cpu, -1, in perf_flag_probe() 42 if (fd < 0 && pid == -1 && errno == EACCES) { in perf_flag_probe() 50 if (fd >= 0) { in perf_flag_probe() 51 close(fd); in perf_flag_probe() 61 fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); in perf_flag_probe() 62 if (fd < 0 && pid == -1 && errno == EACCES) { in perf_flag_probe() 70 if (fd >= 0) in perf_flag_probe() 71 close(fd); in perf_flag_probe() 73 if (WARN_ONCE(fd < 0 && err != EBUSY, in perf_flag_probe()
|
D | header.c | 67 static int do_write(int fd, const void *buf, size_t size) in do_write() argument 70 int ret = write(fd, buf, size); in do_write() 84 static int write_padded(int fd, const void *bf, size_t count, in write_padded() argument 88 int err = do_write(fd, bf, count); in write_padded() 91 err = do_write(fd, zero_buf, count_aligned - count); in write_padded() 96 static int do_write_string(int fd, const char *str) in do_write_string() argument 105 ret = do_write(fd, &len, sizeof(len)); in do_write_string() 109 return write_padded(fd, str, olen, len); in do_write_string() 112 static char *do_read_string(int fd, struct perf_header *ph) in do_read_string() argument 118 sz = readn(fd, &len, sizeof(len)); in do_read_string() [all …]
|
/tools/perf/tests/attr/ |
D | test-stat-detailed-3 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 39 fd=6 45 fd=7 51 fd=8 57 fd=9 63 fd=10 [all …]
|
D | test-stat-detailed-2 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 39 fd=6 45 fd=7 51 fd=8 57 fd=9 63 fd=10 [all …]
|
D | test-stat-detailed-1 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 39 fd=6 45 fd=7 51 fd=8 57 fd=9 63 fd=10 [all …]
|
D | test-stat-default | 8 fd=1 14 fd=2 20 fd=3 26 fd=4 32 fd=5 38 fd=6 44 fd=7 50 fd=8 56 fd=9 62 fd=10
|
/tools/perf/tests/ |
D | fdarray.c | 7 int fd; in fdarray__init_revents() local 11 for (fd = 0; fd < fda->nr; ++fd) { in fdarray__init_revents() 12 fda->entries[fd].fd = fda->nr - fd; in fdarray__init_revents() 13 fda->entries[fd].revents = revents; in fdarray__init_revents() 30 int nr_fds, expected_fd[2], fd, err = TEST_FAIL; in test__fdarray__filter() local 56 expected_fd[0] = fda->entries[2].fd; in test__fdarray__filter() 67 if (fda->entries[0].fd != expected_fd[0]) { in test__fdarray__filter() 69 fda->entries[0].fd, expected_fd[0]); in test__fdarray__filter() 75 expected_fd[0] = fda->entries[0].fd; in test__fdarray__filter() 77 expected_fd[1] = fda->entries[3].fd; in test__fdarray__filter() [all …]
|
D | bp_signal_overflow.c | 44 static long long bp_count(int fd) in bp_count() argument 49 ret = read(fd, &count, sizeof(long long)); in bp_count() 66 int fd, i, fails = 0; in test__bp_signal_overflow() local 95 fd = sys_perf_event_open(&pe, 0, -1, -1, in test__bp_signal_overflow() 97 if (fd < 0) { in test__bp_signal_overflow() 102 fcntl(fd, F_SETFL, O_RDWR|O_NONBLOCK|O_ASYNC); in test__bp_signal_overflow() 103 fcntl(fd, F_SETSIG, SIGIO); in test__bp_signal_overflow() 104 fcntl(fd, F_SETOWN, getpid()); in test__bp_signal_overflow() 106 ioctl(fd, PERF_EVENT_IOC_RESET, 0); in test__bp_signal_overflow() 107 ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); in test__bp_signal_overflow() [all …]
|
D | dso-data.c | 20 int fd, i; in test_file() local 26 fd = mkstemp(templ); in test_file() 27 if (fd < 0) { in test_file() 34 close(fd); in test_file() 41 if (size != write(fd, buf, size)) in test_file() 45 close(fd); in test_file() 238 int dso_cnt, limit, i, fd; in test__dso_data_cache() local 259 fd = dso__data_fd(dso, &machine); in test__dso_data_cache() 260 TEST_ASSERT_VAL("failed to get fd", fd > 0); in test__dso_data_cache() 272 fd = dso__data_fd(dsos[i], &machine); in test__dso_data_cache() [all …]
|
D | bp_signal.c | 63 int fd; in bp_event() local 82 fd = sys_perf_event_open(&pe, 0, -1, -1, in bp_event() 84 if (fd < 0) { in bp_event() 90 fcntl(fd, F_SETFL, O_RDWR|O_NONBLOCK|O_ASYNC); in bp_event() 91 fcntl(fd, F_SETSIG, SIGIO); in bp_event() 92 fcntl(fd, F_SETOWN, getpid()); in bp_event() 95 ioctl(fd, PERF_EVENT_IOC_RESET, 0); in bp_event() 97 return fd; in bp_event() 100 static long long bp_count(int fd) in bp_count() argument 105 ret = read(fd, &count, sizeof(long long)); in bp_count()
|
/tools/power/cpupower/utils/helpers/ |
D | msr.c | 28 int fd; in read_msr() local 32 fd = open(msr_file_name, O_RDONLY); in read_msr() 33 if (fd < 0) in read_msr() 35 if (lseek(fd, idx, SEEK_CUR) == -1) in read_msr() 37 if (read(fd, val, sizeof *val) != sizeof *val) in read_msr() 39 close(fd); in read_msr() 42 close(fd); in read_msr() 57 int fd; in write_msr() local 61 fd = open(msr_file_name, O_WRONLY); in write_msr() 62 if (fd < 0) in write_msr() [all …]
|
D | sysfs.c | 21 int fd; in sysfs_read_file() local 24 fd = open(path, O_RDONLY); in sysfs_read_file() 25 if (fd == -1) in sysfs_read_file() 28 numread = read(fd, buf, buflen - 1); in sysfs_read_file() 30 close(fd); in sysfs_read_file() 35 close(fd); in sysfs_read_file() 51 int fd; in sysfs_is_cpu_online() local 71 fd = open(path, O_RDONLY); in sysfs_is_cpu_online() 72 if (fd == -1) in sysfs_is_cpu_online() 75 numread = read(fd, linebuf, MAX_LINE_LEN - 1); in sysfs_is_cpu_online() [all …]
|
/tools/lib/api/fd/ |
D | array.c | 73 int fdarray__add(struct fdarray *fda, int fd, short revents) in fdarray__add() argument 81 fda->entries[fda->nr].fd = fd; in fdarray__add() 88 void (*entry_destructor)(struct fdarray *fda, int fd)) in fdarray__filter() 90 int fd, nr = 0; in fdarray__filter() local 95 for (fd = 0; fd < fda->nr; ++fd) { in fdarray__filter() 96 if (fda->entries[fd].revents & revents) { in fdarray__filter() 98 entry_destructor(fda, fd); in fdarray__filter() 103 if (fd != nr) { in fdarray__filter() 104 fda->entries[nr] = fda->entries[fd]; in fdarray__filter() 105 fda->priv[nr] = fda->priv[fd]; in fdarray__filter() [all …]
|
/tools/perf/scripts/perl/ |
D | rw-by-file.pl | 31 $common_pid, $common_comm, $nr, $fd, $buf, $count) = @_; 34 $reads{$fd}{bytes_requested} += $count; 35 $reads{$fd}{total_reads}++; 42 $common_pid, $common_comm, $nr, $fd, $buf, $count) = @_; 45 $writes{$fd}{bytes_written} += $count; 46 $writes{$fd}{total_writes}++; 57 foreach my $fd (sort {$reads{$b}{bytes_requested} <=> 59 my $total_reads = $reads{$fd}{total_reads}; 60 my $bytes_requested = $reads{$fd}{bytes_requested}; 61 printf("%6u %10u %10u\n", $fd, $total_reads, $bytes_requested); [all …]
|
/tools/testing/selftests/vm/ |
D | hugetlbfstest.c | 19 int i, fd; in read_rss() local 22 fd = open("/proc/self/statm", O_RDONLY); in read_rss() 23 assert(fd > 2); in read_rss() 25 read(fd, buf, sizeof(buf) - 1); in read_rss() 32 static void do_mmap(int fd, int extra_flags, int unmap) in do_mmap() argument 39 p = mmap(NULL, length, PROT_READ | PROT_WRITE, flags, fd, 0); in do_mmap() 55 int fd, err; in open_file() local 58 fd = open(path, O_CREAT | O_RDWR | O_TRUNC | O_EXCL in open_file() 60 assert(fd > 2); in open_file() 62 err = ftruncate(fd, length); in open_file() [all …]
|
/tools/usb/usbip/libsrc/ |
D | sysfs_utils.c | 12 int fd; in write_sysfs_attribute() local 15 fd = open(attr_path, O_WRONLY); in write_sysfs_attribute() 16 if (fd < 0) { in write_sysfs_attribute() 21 length = write(fd, new_value, len); in write_sysfs_attribute() 24 close(fd); in write_sysfs_attribute() 28 close(fd); in write_sysfs_attribute()
|
/tools/hv/ |
D | hv_vss_daemon.c | 49 int ret, fd = open(dir, O_RDONLY); in vss_do_freeze() local 51 if (fd < 0) in vss_do_freeze() 53 ret = ioctl(fd, cmd, 0); in vss_do_freeze() 55 close(fd); in vss_do_freeze() 107 static int netlink_send(int fd, struct cn_msg *msg) in netlink_send() argument 131 return sendmsg(fd, &message, 0); in netlink_send() 136 int fd, len, nl_group; in main() local 160 fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); in main() 161 if (fd < 0) { in main() 172 error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); in main() [all …]
|
/tools/power/acpi/tools/ec/ |
D | ec_access.c | 126 void dump_ec(int fd) in dump_ec() argument 132 bytes_read = read(fd, buf, EC_SPACE_SIZE); in dump_ec() 152 lseek(fd, 0, SEEK_SET); in dump_ec() 155 bytes_read = read(fd, buf2, EC_SPACE_SIZE); in dump_ec() 176 void read_ec_val(int fd, int byte_offset) in read_ec_val() argument 181 error = lseek(fd, byte_offset, SEEK_SET); in read_ec_val() 185 error = read(fd, &buf, 1); in read_ec_val() 193 void write_ec_val(int fd, int byte_offset, uint8_t value) in write_ec_val() argument 197 error = lseek(fd, byte_offset, SEEK_SET); in write_ec_val() 201 error = write(fd, &value, 1); in write_ec_val() [all …]
|
/tools/power/cpupower/debug/i386/ |
D | powernow-k8-decode.c | 32 int fd; in get_fidvid() local 40 fd = open(file, O_RDONLY); in get_fidvid() 41 if (fd < 0) in get_fidvid() 43 lseek(fd, MSR_FIDVID_STATUS, SEEK_CUR); in get_fidvid() 44 if (read(fd, &msr, 8) != 8) in get_fidvid() 51 close(fd); in get_fidvid()
|
D | centrino-decode.c | 32 int fd; in rdmsr() local 43 fd = open(file, O_RDONLY); in rdmsr() 45 if (fd < 0) in rdmsr() 48 if (lseek(fd, msr, SEEK_CUR) == -1) in rdmsr() 51 if (read(fd, &val, 8) != 8) in rdmsr() 59 close(fd); in rdmsr()
|
/tools/power/acpi/os_specific/service_layers/ |
D | osunixmap.c | 102 int fd; in acpi_os_map_memory() local 104 fd = open(SYSTEM_MEMORY, O_RDONLY | O_BINARY); in acpi_os_map_memory() 105 if (fd < 0) { in acpi_os_map_memory() 118 fd, (where - offset)); in acpi_os_map_memory() 121 close(fd); in acpi_os_map_memory() 125 close(fd); in acpi_os_map_memory()
|