/linux-master/tools/testing/selftests/net/ |
H A D | udpgso_bench_rx.c | 92 static void do_poll(int fd, int timeout_ms) argument 99 pfd.fd = fd; 128 int fd, val; local 130 fd = socket(cfg_family, cfg_tcp ? SOCK_STREAM : SOCK_DGRAM, 0); 131 if (fd == -1) 135 if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val))) 138 if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val))) 141 if (bind(fd, (void *)&cfg_bind_addr, cfg_alen)) 145 int accept_fd = fd; 165 do_flush_tcp(int fd) argument 215 recv_msg(int fd, char *buf, int len, int *gso_size) argument 248 do_flush_udp(int fd) argument 358 int fd; local [all...] |
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/mm/ |
H A D | split_huge_page_test.c | 58 int fd; local 61 fd = open(path, O_WRONLY); 62 if (fd == -1) 65 numwritten = write(fd, buf, buflen - 1); 66 close(fd); 207 int fd; local 226 fd = open(testfile, O_CREAT|O_WRONLY, 0664); 227 if (fd == -1) { 233 num_written = write(fd, tmpfs_loc, strlen(tmpfs_loc) + 1); 234 close(fd); 299 create_pagecache_thp_and_fd(const char *testfile, size_t fd_size, int *fd, char **addr) argument 364 int fd; local [all...] |
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/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/bpf/ |
H A D | network_helpers.c | 57 int settimeo(int fd, int timeout_ms) argument 66 if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, 72 if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, 81 #define save_errno_close(fd) ({ int __save = errno; close(fd); errno = __save; }) 86 int fd; local 88 fd = socket(addr->sa_family, type, opts->proto); 89 if (fd < 0) { 94 if (settimeo(fd, opts->timeout_ms)) 97 if (opts->post_socket_cb && opts->post_socket_cb(fd, NUL 136 reuseport_cb(int fd, const struct post_socket_opts *opts) argument 210 int fd, ret; local 241 connect_fd_to_addr(int fd, const struct sockaddr_storage *addr, socklen_t addrlen, const bool must_fail) argument 271 int fd; local 300 int fd, type, protocol; local 573 int fd; member in struct:send_recv_arg 583 int err = 0, fd; local 626 send_recv_data(int lfd, int fd, uint32_t total_bytes) argument [all...] |
/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 | 94 int fd, misalign = misalignments[j]; local 121 fd = raw_openat2(AT_FDCWD, ".", how_copy, test->size); 123 failed = (fd < 0); 125 failed = (fd != test->err); 126 if (fd >= 0) { 127 fdpath = fdreadlink(fd); 128 close(fd); 136 ksft_print_msg("%d['%s']\n", fd, fdpath); 138 ksft_print_msg("%d (%s)\n", fd, strerror(-fd)); 247 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/testing/selftests/bpf/prog_tests/ |
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/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/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; 76 static void slirp_close(int fd, void *data) argument 81 close(fd); 105 int slirp_user_read(int fd, void *buf, int len, struct slirp_data *pri) argument 107 return slip_proto_read(fd, buf, len, &pri->slip); 110 int slirp_user_write(int fd, void *buf, int len, struct slirp_data *pri) argument 112 return slip_proto_write(fd, buf, len, &pri->slip);
|
/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/net/af_unix/ |
H A D | scm_rights.c | 17 int fd[16]; local 133 self->fd[i] = socket(AF_UNIX, SOCK_STREAM, 0); 134 ASSERT_LE(0, self->fd[i]); 137 ret = bind(self->fd[i], (struct sockaddr *)&addr, addrlen); 140 ret = listen(self->fd[i], -1); 144 ret = getsockname(self->fd[i], (struct sockaddr *)&addr, &addrlen); 147 self->fd[i + 1] = socket(AF_UNIX, SOCK_STREAM, 0); 148 ASSERT_LE(0, self->fd[i + 1]); 150 ret = connect(self->fd[i + 1], (struct sockaddr *)&addr, addrlen); 162 ASSERT_GE(sizeof(self->fd) / sizeo 204 int fd[2]; member in struct:__anon194 [all...] |