/linux-master/samples/hidraw/ |
H A D | hid-example.c | 45 int fd; local 57 fd = open(device, O_RDWR|O_NONBLOCK); 59 if (fd < 0) { 69 res = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size); 77 res = ioctl(fd, HIDIOCGRDESC, &rpt_desc); 88 res = ioctl(fd, HIDIOCGRAWNAME(256), buf); 95 res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); 102 res = ioctl(fd, HIDIOCGRAWINFO, &info); 118 res = ioctl(fd, HIDIOCSFEATURE(4), buf); 126 res = ioctl(fd, HIDIOCGFEATUR [all...] |
/linux-master/tools/perf/tests/ |
H A D | fdarray.c | 2 #include <api/fd/array.h> 9 int fd; local 13 for (fd = 0; fd < fda->nr; ++fd) { 14 fda->entries[fd].fd = fda->nr - fd; 15 fda->entries[fd].events = revents; 16 fda->entries[fd] [all...] |
/linux-master/tools/testing/selftests/net/ |
H A D | reuseport_bpf.c | 92 static void attach_ebpf(int fd, uint16_t mod) argument 124 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_EBPF, &bpf_fd, 131 static void attach_cbpf(int fd, uint16_t mod) argument 146 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_CBPF, &p, sizeof(p))) 150 static void build_recv_group(const struct test_params p, int fd[], uint16_t mod, argument 158 fd[i] = socket(p.recv_family, p.protocol, 0); 159 if (fd[i] < 0) 163 if (setsockopt(fd[i], SOL_SOCKET, SO_REUSEPORT, &opt, 168 attach_bpf(fd[i], mod); 170 if (bind(fd[ 192 const int fd = socket(p.send_family, p.protocol, 0), one = 1; local 211 test_recv_order(const struct test_params p, int fd[], int mod) argument 273 int i, fd[p.recv_socks]; local 290 int i, fd[p.recv_socks]; local 349 int fd, bpf_fd; local 413 int fd = open("/proc/sys/net/ipv4/tcp_fastopen", 0); local [all...] |
/linux-master/tools/testing/selftests/bpf/prog_tests/ |
H A D | dummy_st_ops.c | 36 int fd, err; local 42 fd = bpf_program__fd(skel->progs.test_1); 43 err = bpf_prog_test_run_opts(fd, &attr); 63 int fd, err; local 69 fd = bpf_program__fd(skel->progs.test_1); 76 fd, "test_1"); 88 err = bpf_prog_test_run_opts(fd, &attr); 107 int fd, err; local 115 fd = bpf_program__fd(skel->progs.test_2); 116 err = bpf_prog_test_run_opts(fd, 134 int fd, err; local [all...] |
H A D | bpf_iter_setsockopt_unix.c | 17 int fd, err; local 19 fd = socket(AF_UNIX, SOCK_STREAM, 0); 20 if (!ASSERT_NEQ(fd, -1, "socket")) 24 err = bind(fd, (struct sockaddr *)&addr, len); 29 err = getsockname(fd, (struct sockaddr *)&addr, &len); 36 return fd; 39 static void test_sndbuf(struct bpf_iter_setsockopt_unix *skel, int fd) argument 49 err = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, 56 err = getsockopt(fd, SOL_SOCKET, SO_SNDBUF,
|
/linux-master/arch/um/drivers/ |
H A D | slirp_user.c | 37 static int slirp_tramp(char **argv, int fd) argument 42 pe_data.stdin_fd = fd; 43 pe_data.stdout_fd = fd; 77 static void slirp_close(int fd, void *data) argument 82 close(fd); 106 int slirp_user_read(int fd, void *buf, int len, struct slirp_data *pri) argument 108 return slip_proto_read(fd, buf, len, &pri->slip); 111 int slirp_user_write(int fd, void *buf, int len, struct slirp_data *pri) argument 113 return slip_proto_write(fd, buf, len, &pri->slip);
|
/linux-master/tools/testing/selftests/openat2/ |
H A D | rename_attack_test.c | 109 int fd; local 113 fd = sys_openat2(afd, victim_path, &how); 115 fd = sys_openat(afd, victim_path, &how); 117 if (fd < 0) { 118 if (fd == -EAGAIN) 120 else if (fd == -EXDEV) 122 else if (fd == -ENOENT) 127 if (fdequal(fd, afd, NULL)) 130 escapes++; /* we got an unexpected fd */ 132 close(fd); [all...] |
H A D | openat2_test.c | 93 int fd, misalign = misalignments[j]; local 120 fd = raw_openat2(AT_FDCWD, ".", how_copy, test->size); 122 failed = (fd < 0); 124 failed = (fd != test->err); 125 if (fd >= 0) { 126 fdpath = fdreadlink(fd); 127 close(fd); 135 ksft_print_msg("%d['%s']\n", fd, fdpath); 137 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); 246 int fd, fdflags = -1; local [all...] |
/linux-master/tools/testing/selftests/timens/ |
H A D | timer.c | 22 timer_t fd; local 42 if (timer_create(clockid, &sevp, &fd) == -1) { 52 if (timer_settime(fd, flags, &new_value, NULL) == -1) 55 if (timer_gettime(fd, &new_value) == -1) 73 int ret, status, len, fd; local 93 fd = open("/proc/self/timens_offsets", O_WRONLY); 94 if (fd < 0) 97 if (write(fd, buf, len) != len) 100 close(fd);
|
H A D | timens.h | 66 int fd, len; local 74 fd = open("/proc/self/timens_offsets", O_WRONLY); 75 if (fd < 0) 78 if (write(fd, buf, len) != len) 81 close(fd);
|
/linux-master/tools/testing/selftests/intel_pstate/ |
H A D | aperf.c | 24 unsigned int i, cpu, fd; local 47 fd = open(msr_file_name, O_RDONLY); 49 if (fd == -1) { 66 pread(fd, &old_tsc, sizeof(old_tsc), 0x10); 67 pread(fd, &old_aperf, sizeof(old_mperf), 0xe7); 68 pread(fd, &old_mperf, sizeof(old_aperf), 0xe8); 78 pread(fd, &new_tsc, sizeof(new_tsc), 0x10); 79 pread(fd, &new_aperf, sizeof(new_mperf), 0xe7); 80 pread(fd, &new_mperf, sizeof(new_aperf), 0xe8);
|
/linux-master/tools/perf/util/ |
H A D | bpf_counter.h | 23 int fd); 46 int bpf_counter__install_pe(struct evsel *evsel, int cpu_map_idx, int fd); 79 int fd __maybe_unused) 95 static inline __u32 bpf_link_get_id(int fd) argument 100 bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len); 104 static inline __u32 bpf_link_get_prog_id(int fd) argument 109 bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len); 113 static inline __u32 bpf_map_get_id(int fd) argument 118 bpf_obj_get_info_by_fd(fd, &map_info, &map_info_len);
|
H A D | bpf_map.c | 32 int fd = bpf_map__fd(map), err; local 35 if (fd < 0) 36 return fd; 50 while ((err = bpf_map_get_next_key(fd, prev_key, key) == 0)) { 53 if (!bpf_map_lookup_elem(fd, key, value)) {
|
/linux-master/tools/testing/selftests/powerpc/mce/ |
H A D | inject-ra-err.c | 31 int fd, *paste_addr; local 44 fd = open(devname, O_RDWR); 45 FAIL_IF(fd < 0); 46 FAIL_IF(ioctl(fd, VAS_TX_WIN_OPEN, &attr) < 0); 49 paste_addr = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0ULL);
|
/linux-master/tools/testing/selftests/powerpc/pmu/event_code_tests/ |
H A D | event_alternatives_tests_p9.c | 53 FAIL_IF(event_open_with_group(&event, leader.fd)); 66 FAIL_IF(event_open_with_group(&event, leader.fd)); 79 FAIL_IF(event_open_with_group(&event, leader.fd)); 92 FAIL_IF(event_open_with_group(&event, leader.fd)); 105 FAIL_IF(event_open_with_group(&event, leader.fd));
|
/linux-master/tools/testing/selftests/watchdog/ |
H A D | watchdog-test.c | 28 int fd; variable 58 ret = ioctl(fd, WDIOC_KEEPALIVE, &dummy); 70 int ret = write(fd, &v, 1); 72 close(fd); 189 fd = open(file, O_WRONLY); 191 if (fd == -1) { 205 ret = ioctl(fd, WDIOC_GETSUPPORT, &info); 208 close(fd); 219 ret = ioctl(fd, WDIOC_GETBOOTSTATUS, &flags); 227 ret = ioctl(fd, WDIOC_SETOPTION [all...] |
/linux-master/tools/testing/selftests/proc/ |
H A D | proc-uptime-002.c | 51 int fd; local 62 fd = open("/proc/uptime", O_RDONLY); 63 assert(fd >= 0); 65 u0 = proc_uptime(fd); 75 u1 = proc_uptime(fd);
|
/linux-master/drivers/infiniband/hw/hfi1/ |
H A D | user_exp_rcv.h | 51 int hfi1_user_exp_rcv_init(struct hfi1_filedata *fd, 53 void hfi1_user_exp_rcv_free(struct hfi1_filedata *fd); 54 int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, 56 int hfi1_user_exp_rcv_clear(struct hfi1_filedata *fd, 58 int hfi1_user_exp_rcv_invalid(struct hfi1_filedata *fd,
|
/linux-master/tools/testing/selftests/net/mptcp/ |
H A D | mptcp_connect.c | 195 static void set_rcvbuf(int fd, unsigned int size) argument 199 err = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); 206 static void set_sndbuf(int fd, unsigned int size) argument 210 err = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); 217 static void set_mark(int fd, uint32_t mark) argument 221 err = setsockopt(fd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)); 228 static void set_transparent(int fd, int pf) argument 234 if (-1 == setsockopt(fd, SOL_IP, IP_TRANSPARENT, &one, sizeof(one))) 238 if (-1 == setsockopt(fd, IPPROTO_IPV6, IPV6_TRANSPARENT, &one, sizeof(one))) 244 static void set_mptfo(int fd, in argument 415 do_rnd_write(const int fd, char *buf, const size_t len) argument 447 do_write(const int fd, char *buf, const size_t len) argument 505 do_recvmsg_cmsg(const int fd, char *buf, const size_t len) argument 563 do_rnd_read(const int fd, char *buf, const size_t len) argument 591 set_nonblock(int fd, bool nonblock) argument 604 shut_wr(int fd) argument 762 spool_buf(int fd, struct wstate *winfo) argument 811 get_infd_size(int fd) argument 1013 check_getpeername(int fd, struct sockaddr_storage *ss, socklen_t salen) argument 1045 check_getpeername_connect(int fd) argument 1065 maybe_close(int fd) argument 1080 int fd = 0; local 1139 xsetsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen) argument 1150 apply_cmsg_types(int fd, const struct cfg_cmsg_types *cmsg) argument 1214 xdisconnect(int fd, int addrlen) argument 1246 int fd = 0, ret, fd_in = 0; local 1484 int fd = sock_listen_mptcp(cfg_host, cfg_port); local [all...] |
/linux-master/tools/testing/selftests/lsm/ |
H A D | common.c | 22 int fd; local 32 fd = open(path, O_RDONLY); 35 if (fd < 0) 37 len = read(fd, value, size); 39 close(fd);
|
/linux-master/tools/testing/vsock/ |
H A D | util.h | 51 void vsock_wait_remote_close(int fd); 52 void send_buf(int fd, const void *buf, size_t len, int flags, 54 void recv_buf(int fd, void *buf, size_t len, int flags, ssize_t expected_ret); 55 void send_byte(int fd, int expected_ret, int flags); 56 void recv_byte(int fd, int expected_ret, int flags);
|
/linux-master/tools/testing/selftests/exec/ |
H A D | recursion-depth.c | 30 int fd, rv; local 52 fd = creat(FILENAME, 0700); 53 if (fd == -1) 57 if (write(fd, S, strlen(S)) != strlen(S)) 60 close(fd);
|
/linux-master/tools/testing/selftests/mm/ |
H A D | vm_util.h | 34 uint64_t pagemap_get_entry(int fd, char *start); 35 bool pagemap_is_softdirty(int fd, char *start); 36 bool pagemap_is_swapped(int fd, char *start); 37 bool pagemap_is_populated(int fd, char *start); 38 unsigned long pagemap_get_pfn(int fd, char *start);
|
/linux-master/tools/testing/selftests/cgroup/ |
H A D | cgroup_util.c | 26 int fd; local 28 fd = open(path, O_RDONLY); 29 if (fd < 0) 32 len = read(fd, buf, max_len - 1); 37 close(fd); 44 int fd; local 46 fd = open(path, O_WRONLY | O_APPEND); 47 if (fd < 0) 50 len = write(fd, buf, len); 51 close(fd); 472 alloc_pagecache(int fd, size_t size) argument 527 int fd, len; local 609 int fd, ret = -1; local 634 cg_wait_for(int fd) argument [all...] |
/linux-master/tools/testing/selftests/sparc64/drivers/ |
H A D | adi-test.c | 180 static int read_adi(int fd, unsigned char *buf, int buf_sz) argument 187 ret = read(fd, buf + bytes_read, buf_sz - bytes_read); 204 static int pread_adi(int fd, unsigned char *buf, argument 214 ret = pread(fd, buf + bytes_read, buf_sz - bytes_read, 236 static int write_adi(int fd, const unsigned char * const buf, int buf_sz) argument 243 ret = write(fd, buf + bytes_written, buf_sz - bytes_written); 259 static int pwrite_adi(int fd, const unsigned char * const buf, argument 270 ret = pwrite(fd, buf + bytes_written, 293 static off_t seek_adi(int fd, off_t offset, int whence) argument 299 ret = lseek(fd, offse 313 test0_prpw_aligned_1byte(int fd) argument 347 test1_prpw_aligned_4096bytes(int fd) argument 387 test2_prpw_aligned_10327bytes(int fd) argument 427 test3_prpw_unaligned_12541bytes(int fd) argument 466 test4_lseek(int fd) argument 515 test5_rw_aligned_1byte(int fd) argument 560 test6_rw_aligned_9434bytes(int fd) argument 612 test7_rw_aligned_14963bytes(int fd) argument 681 int fd, ret, test; local [all...] |