/tools/testing/selftests/memfd/ |
D | memfd_test.c | 69 int r, fd; in mfd_assert_new() local 71 fd = sys_memfd_create(name, flags); in mfd_assert_new() 72 if (fd < 0) { in mfd_assert_new() 78 r = ftruncate(fd, sz); in mfd_assert_new() 84 return fd; in mfd_assert_new() 100 static unsigned int mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument 104 r = fcntl(fd, F_GET_SEALS); in mfd_assert_get_seals() 106 printf("GET_SEALS(%d) failed: %m\n", fd); in mfd_assert_get_seals() 113 static void mfd_assert_has_seals(int fd, unsigned int seals) in mfd_assert_has_seals() argument 117 s = mfd_assert_get_seals(fd); in mfd_assert_has_seals() [all …]
|
D | fuse_test.c | 47 int r, fd; in mfd_assert_new() local 49 fd = sys_memfd_create(name, flags); in mfd_assert_new() 50 if (fd < 0) { in mfd_assert_new() 56 r = ftruncate(fd, sz); in mfd_assert_new() 62 return fd; in mfd_assert_new() 65 static __u64 mfd_assert_get_seals(int fd) in mfd_assert_get_seals() argument 69 r = fcntl(fd, F_GET_SEALS); in mfd_assert_get_seals() 71 printf("GET_SEALS(%d) failed: %m\n", fd); in mfd_assert_get_seals() 78 static void mfd_assert_has_seals(int fd, __u64 seals) in mfd_assert_has_seals() argument 82 s = mfd_assert_get_seals(fd); in mfd_assert_has_seals() [all …]
|
/tools/testing/selftests/efivarfs/ |
D | open-unlink.c | 16 int fd; in set_immutable() local 20 fd = open(path, O_RDONLY); in set_immutable() 21 if (fd < 0) in set_immutable() 22 return fd; in set_immutable() 24 rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); in set_immutable() 27 close(fd); in set_immutable() 37 rc = ioctl(fd, FS_IOC_SETFLAGS, &flags); in set_immutable() 39 close(fd); in set_immutable() 47 int fd; in get_immutable() local 51 fd = open(path, O_RDONLY); in get_immutable() [all …]
|
/tools/testing/selftests/bpf/ |
D | test_maps.c | 33 int fd; in test_hashmap() local 35 fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value), in test_hashmap() 37 if (fd < 0) { in test_hashmap() 45 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0); in test_hashmap() 49 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == -1 && in test_hashmap() 54 assert(bpf_map_update_elem(fd, &key, &value, -1) == -1 && in test_hashmap() 58 assert(bpf_map_lookup_elem(fd, &key, &value) == 0 && value == 1234); in test_hashmap() 62 assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT); in test_hashmap() 65 assert(bpf_map_update_elem(fd, &key, &value, BPF_EXIST) == -1 && in test_hashmap() 70 assert(bpf_map_update_elem(fd, &key, &value, BPF_NOEXIST) == 0); in test_hashmap() [all …]
|
/tools/testing/selftests/sync/ |
D | sync.c | 58 int sync_wait(int fd, int timeout) in sync_wait() argument 62 fds.fd = fd; in sync_wait() 84 static struct sync_file_info *sync_file_info(int fd) in sync_file_info() argument 94 err = ioctl(fd, SYNC_IOC_FILE_INFO, info); in sync_file_info() 114 err = ioctl(fd, SYNC_IOC_FILE_INFO, info); in sync_file_info() 131 int sync_fence_size(int fd) in sync_fence_size() argument 134 struct sync_file_info *info = sync_file_info(fd); in sync_fence_size() 146 int sync_fence_count_with_status(int fd, int status) in sync_fence_count_with_status() argument 150 struct sync_file_info *info = sync_file_info(fd); in sync_fence_count_with_status() 171 int sw_sync_timeline_inc(int fd, unsigned int count) in sw_sync_timeline_inc() argument [all …]
|
D | sw_sync.h | 38 int sw_sync_timeline_is_valid(int fd); 39 int sw_sync_timeline_inc(int fd, unsigned int count); 40 void sw_sync_timeline_destroy(int fd); 42 int sw_sync_fence_create(int fd, const char *name, unsigned int value); 43 int sw_sync_fence_is_valid(int fd); 44 void sw_sync_fence_destroy(int fd);
|
/tools/perf/tests/ |
D | fdarray.c | 9 int fd; in fdarray__init_revents() local 13 for (fd = 0; fd < fda->nr; ++fd) { in fdarray__init_revents() 14 fda->entries[fd].fd = fda->nr - fd; in fdarray__init_revents() 15 fda->entries[fd].revents = revents; in fdarray__init_revents() 32 int nr_fds, expected_fd[2], fd, err = TEST_FAIL; in test__fdarray__filter() local 58 expected_fd[0] = fda->entries[2].fd; in test__fdarray__filter() 69 if (fda->entries[0].fd != expected_fd[0]) { in test__fdarray__filter() 71 fda->entries[0].fd, expected_fd[0]); in test__fdarray__filter() 77 expected_fd[0] = fda->entries[0].fd; in test__fdarray__filter() 79 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 …]
|
/tools/perf/tests/attr/ |
D | test-stat-detailed-3 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 40 fd=6 47 fd=7 54 fd=8 61 fd=9 68 fd=10 [all …]
|
D | test-stat-detailed-2 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 40 fd=6 47 fd=7 54 fd=8 61 fd=9 68 fd=10 [all …]
|
D | test-stat-detailed-1 | 9 fd=1 15 fd=2 21 fd=3 27 fd=4 33 fd=5 40 fd=6 47 fd=7 54 fd=8 61 fd=9 68 fd=10 [all …]
|
D | test-stat-default | 8 fd=1 14 fd=2 20 fd=3 26 fd=4 32 fd=5 39 fd=6 46 fd=7 53 fd=8 60 fd=9 67 fd=10
|
/tools/perf/util/ |
D | data.c | 28 int fd = perf_data_file__is_read(file) ? in check_pipe() local 32 if (!fstat(fd, &st) && S_ISFIFO(st.st_mode)) in check_pipe() 40 file->fd = fd; in check_pipe() 64 int fd; in open_file_read() local 67 fd = open(file->path, O_RDONLY); in open_file_read() 68 if (fd < 0) { in open_file_read() 79 if (fstat(fd, &st) < 0) in open_file_read() 95 return fd; in open_file_read() 98 close(fd); in open_file_read() 104 int fd; in open_file_write() local [all …]
|
D | cloexec.c | 36 int fd; in perf_flag_probe() local 52 fd = sys_perf_event_open(&attr, pid, cpu, -1, in perf_flag_probe() 54 if (fd < 0 && pid == -1 && errno == EACCES) { in perf_flag_probe() 62 if (fd >= 0) { in perf_flag_probe() 63 close(fd); in perf_flag_probe() 73 fd = sys_perf_event_open(&attr, pid, cpu, -1, 0); in perf_flag_probe() 74 if (fd < 0 && pid == -1 && errno == EACCES) { in perf_flag_probe() 82 if (fd >= 0) in perf_flag_probe() 83 close(fd); in perf_flag_probe() 85 if (WARN_ONCE(fd < 0 && err != EBUSY, in perf_flag_probe()
|
/tools/power/cpupower/utils/helpers/ |
D | msr.c | 29 int fd; in read_msr() local 33 fd = open(msr_file_name, O_RDONLY); in read_msr() 34 if (fd < 0) in read_msr() 36 if (lseek(fd, idx, SEEK_CUR) == -1) in read_msr() 38 if (read(fd, val, sizeof *val) != sizeof *val) in read_msr() 40 close(fd); in read_msr() 43 close(fd); in read_msr() 58 int fd; in write_msr() local 62 fd = open(msr_file_name, O_WRONLY); in write_msr() 63 if (fd < 0) in write_msr() [all …]
|
/tools/testing/selftests/powerpc/dscr/ |
D | dscr.h | 77 int fd = -1, ret; in get_default_dscr() local 81 if (fd == -1) { in get_default_dscr() 82 fd = open(DSCR_DEFAULT, O_RDONLY); in get_default_dscr() 83 if (fd == -1) { in get_default_dscr() 89 lseek(fd, 0, SEEK_SET); in get_default_dscr() 90 ret = read(fd, buf, sizeof(buf)); in get_default_dscr() 96 close(fd); in get_default_dscr() 102 int fd = -1, ret; in set_default_dscr() local 105 if (fd == -1) { in set_default_dscr() 106 fd = open(DSCR_DEFAULT, O_RDWR); in set_default_dscr() [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/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, void *arg), in fdarray__filter() 91 int fd, nr = 0; in fdarray__filter() local 96 for (fd = 0; fd < fda->nr; ++fd) { in fdarray__filter() 97 if (fda->entries[fd].revents & revents) { in fdarray__filter() 99 entry_destructor(fda, fd, arg); in fdarray__filter() 104 if (fd != nr) { in fdarray__filter() 105 fda->entries[nr] = fda->entries[fd]; in fdarray__filter() 106 fda->priv[nr] = fda->priv[fd]; in fdarray__filter() [all …]
|
/tools/testing/selftests/vm/ |
D | compaction_test.c | 59 int fd; in prereq() local 61 fd = open("/proc/sys/vm/compact_unevictable_allowed", in prereq() 63 if (fd < 0) { in prereq() 69 if (read(fd, &allowed, sizeof(char)) != sizeof(char)) { in prereq() 72 close(fd); in prereq() 76 close(fd); in prereq() 85 int fd; in check_compaction() local 94 fd = open("/proc/sys/vm/nr_hugepages", O_RDWR | O_NONBLOCK); in check_compaction() 95 if (fd < 0) { in check_compaction() 100 if (read(fd, initial_nr_hugepages, sizeof(initial_nr_hugepages)) <= 0) { in check_compaction() [all …]
|
/tools/spi/ |
D | spidev_fdx.c | 18 static void do_read(int fd, int len) in do_read() argument 30 status = read(fd, buf, len); in do_read() 49 static void do_msg(int fd, int len) in do_msg() argument 68 status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer); in do_msg() 80 static void dumpstat(const char *name, int fd) in dumpstat() argument 85 if (ioctl(fd, SPI_IOC_RD_MODE32, &mode) < 0) { in dumpstat() 89 if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) { in dumpstat() 93 if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) { in dumpstat() 97 if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) { in dumpstat() 111 int fd; in main() local [all …]
|
/tools/testing/selftests/net/ |
D | msg_zerocopy.c | 132 static void do_setsockopt(int fd, int level, int optname, int val) in do_setsockopt() argument 134 if (setsockopt(fd, level, optname, &val, sizeof(val))) in do_setsockopt() 138 static int do_poll(int fd, int events) in do_poll() argument 145 pfd.fd = fd; in do_poll() 154 static int do_accept(int fd) in do_accept() argument 156 int fda = fd; in do_accept() 158 fd = accept(fda, NULL, NULL); in do_accept() 159 if (fd == -1) in do_accept() 164 return fd; in do_accept() 167 static bool do_sendmsg(int fd, struct msghdr *msg, bool do_zerocopy) in do_sendmsg() argument [all …]
|
/tools/leds/ |
D | led_hw_brightness_mon.c | 28 int fd, ret; in main() local 42 fd = open(brightness_file_path, O_RDONLY); in main() 43 if (fd == -1) { in main() 53 read(fd, buf, sizeof(buf)); in main() 55 pollfd.fd = fd; in main() 69 ret = read(fd, buf, sizeof(buf)); in main() 73 ret = lseek(pollfd.fd, 0, SEEK_SET); in main() 82 close(fd); in main()
|
D | uledmon.c | 25 int fd, ret; in main() local 37 fd = open("/dev/uleds", O_RDWR); in main() 38 if (fd == -1) { in main() 43 ret = write(fd, &uleds_dev, sizeof(uleds_dev)); in main() 46 close(fd); in main() 51 ret = read(fd, &brightness, sizeof(brightness)); in main() 54 close(fd); in main() 61 close(fd); in main()
|
/tools/gpio/ |
D | gpio-utils.c | 68 int fd; in gpiotools_request_linehandle() local 76 fd = open(chrdev_name, 0); in gpiotools_request_linehandle() 77 if (fd == -1) { in gpiotools_request_linehandle() 92 ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &req); in gpiotools_request_linehandle() 100 if (close(fd) == -1) in gpiotools_request_linehandle() 103 return ret < 0 ? ret : req.fd; in gpiotools_request_linehandle() 114 int gpiotools_set_values(const int fd, struct gpiohandle_data *data) in gpiotools_set_values() argument 118 ret = ioctl(fd, GPIOHANDLE_SET_LINE_VALUES_IOCTL, data); in gpiotools_set_values() 137 int gpiotools_get_values(const int fd, struct gpiohandle_data *data) in gpiotools_get_values() argument 141 ret = ioctl(fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, data); in gpiotools_get_values() [all …]
|
/tools/power/acpi/tools/acpidbg/ |
D | acpidbg.c | 100 static int acpi_aml_set_fl(int fd, int flags) in acpi_aml_set_fl() argument 104 ret = fcntl(fd, F_GETFL, 0); in acpi_aml_set_fl() 110 ret = fcntl(fd, F_SETFL, flags); in acpi_aml_set_fl() 118 static int acpi_aml_set_fd(int fd, int maxfd, fd_set *set) in acpi_aml_set_fd() argument 120 if (fd > maxfd) in acpi_aml_set_fd() 121 maxfd = fd; in acpi_aml_set_fd() 122 FD_SET(fd, set); in acpi_aml_set_fd() 126 static int acpi_aml_read(int fd, struct circ_buf *crc) in acpi_aml_read() argument 133 len = read(fd, p, len); in acpi_aml_read() 162 static int acpi_aml_read_batch_log(int fd, struct circ_buf *crc) in acpi_aml_read_batch_log() argument [all …]
|