Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 39) sorted by relevance

12

/samples/timers/
Dhpet_example.c82 int fd; in hpet_open_close() local
89 fd = open(argv[0], O_RDONLY); in hpet_open_close()
90 if (fd < 0) in hpet_open_close()
93 close(fd); in hpet_open_close()
102 int fd; in hpet_info() local
109 fd = open(argv[0], O_RDONLY); in hpet_info()
110 if (fd < 0) { in hpet_info()
115 if (ioctl(fd, HPET_INFO, &info) < 0) { in hpet_info()
126 close(fd); in hpet_info()
134 int iterations, i, fd; in hpet_poll() local
[all …]
/samples/bpf/
Dfds_example.c79 int fd, ret; in bpf_do_map() local
82 fd = bpf_map_create(); in bpf_do_map()
83 printf("bpf: map fd:%d (%s)\n", fd, strerror(errno)); in bpf_do_map()
84 assert(fd > 0); in bpf_do_map()
86 ret = bpf_obj_pin(fd, file); in bpf_do_map()
90 fd = bpf_obj_get(file); in bpf_do_map()
91 printf("bpf: get fd:%d (%s)\n", fd, strerror(errno)); in bpf_do_map()
92 assert(fd > 0); in bpf_do_map()
96 ret = bpf_map_update_elem(fd, &key, &value, 0); in bpf_do_map()
97 printf("bpf: fd:%d u->(%u:%u) ret:(%d,%s)\n", fd, key, value, in bpf_do_map()
[all …]
Dtest_overhead_user.c41 int i, fd; in test_task_rename() local
43 fd = open("/proc/self/comm", O_WRONLY|O_TRUNC); in test_task_rename()
44 if (fd < 0) { in test_task_rename()
50 if (write(fd, buf, sizeof(buf)) < 0) { in test_task_rename()
52 close(fd); in test_task_rename()
58 close(fd); in test_task_rename()
65 int i, fd; in test_urandom_read() local
67 fd = open("/dev/urandom", O_RDONLY); in test_urandom_read()
68 if (fd < 0) { in test_urandom_read()
74 if (read(fd, buf, sizeof(buf)) < 0) { in test_urandom_read()
[all …]
Dtask_fd_query_user.c51 int fd, ret; in bpf_find_probe_type() local
56 fd = open(buf, O_RDONLY); in bpf_find_probe_type()
57 CHECK_PERROR_RET(fd < 0); in bpf_find_probe_type()
59 ret = read(fd, buf, sizeof(buf)); in bpf_find_probe_type()
60 close(fd); in bpf_find_probe_type()
73 int fd, ret; in bpf_get_retprobe_bit() local
78 fd = open(buf, O_RDONLY); in bpf_get_retprobe_bit()
79 CHECK_PERROR_RET(fd < 0); in bpf_get_retprobe_bit()
81 ret = read(fd, buf, sizeof(buf)); in bpf_get_retprobe_bit()
82 close(fd); in bpf_get_retprobe_bit()
[all …]
Dcpustat_user.c156 int len, fd; in cpu_stat_inject_cpu_frequency_event() local
158 fd = open(CPUFREQ_MAX_SYSFS_PATH, O_WRONLY); in cpu_stat_inject_cpu_frequency_event()
159 if (fd < 0) { in cpu_stat_inject_cpu_frequency_event()
161 return fd; in cpu_stat_inject_cpu_frequency_event()
164 len = write(fd, CPUFREQ_LOWEST_FREQ, strlen(CPUFREQ_LOWEST_FREQ)); in cpu_stat_inject_cpu_frequency_event()
170 len = write(fd, CPUFREQ_HIGHEST_FREQ, strlen(CPUFREQ_HIGHEST_FREQ)); in cpu_stat_inject_cpu_frequency_event()
177 close(fd); in cpu_stat_inject_cpu_frequency_event()
Dsockex3_user.c28 int i, sock, key, fd, main_prog_fd, jmp_table_fd, hash_map_fd; in main() local
57 fd = bpf_program__fd(prog); in main()
66 main_prog_fd = fd; in main()
68 bpf_map_update_elem(jmp_table_fd, &key, &fd, BPF_ANY); in main()
Dtracex3_user.c18 static void clear_stats(int fd) in clear_stats() argument
26 bpf_map_update_elem(fd, &key, values, BPF_ANY); in clear_stats()
75 static void print_hist(int fd) in print_hist() argument
87 bpf_map_lookup_elem(fd, &key, values); in print_hist()
96 clear_stats(fd); in print_hist()
Dtracex2_user.c43 static void print_hist_for_pid(int fd, void *task) in print_hist_for_pid() argument
55 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_hist_for_pid()
60 bpf_map_lookup_elem(fd, &next_key, values); in print_hist_for_pid()
83 static void print_hist(int fd) in print_hist() argument
90 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_hist()
106 print_hist_for_pid(fd, &tasks[i]); in print_hist()
Dtracex5_user.c40 int key, fd, progs_fd; in main() local
83 fd = bpf_program__fd(prog); in main()
84 bpf_map_update_elem(progs_fd, &key, &fd, BPF_ANY); in main()
Dsyscall_tp_user.c48 int map0_fds[num_progs], map1_fds[num_progs], fd, i, j = 0; in test() local
94 fd = open(filename, O_RDONLY); in test()
95 if (fd < 0) { in test()
99 close(fd); in test()
Dtracex4_user.c29 static void print_old_objects(int fd) in print_old_objects() argument
38 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_old_objects()
39 bpf_map_lookup_elem(fd, &next_key, &v); in print_old_objects()
Dxdpsock_ctrl_proc.c59 static int send_xsks_map_fd(int sock, int fd) in send_xsks_map_fd() argument
66 if (fd == -1) { in send_xsks_map_fd()
67 fprintf(stderr, "Incorrect fd = %d\n", fd); in send_xsks_map_fd()
87 *(int *)CMSG_DATA(cmsg) = fd; in send_xsks_map_fd()
Doffwaketime_user.c78 static void print_stacks(int fd) in print_stacks() argument
83 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_stacks()
84 bpf_map_lookup_elem(fd, &next_key, &value); in print_stacks()
Dxdp_sample_pkts_user.c27 static int do_attach(int idx, int fd, const char *name) in do_attach() argument
33 err = bpf_set_link_xdp_fd(idx, fd, xdp_flags); in do_attach()
39 err = bpf_obj_get_info_by_fd(fd, &info, &info_len); in do_attach()
Dibumad_user.c35 static void dump_counts(int fd) in dump_counts() argument
41 if (bpf_map_lookup_elem(fd, &key, &value)) { in dump_counts()
Dsampleip_user.c89 static void print_ip_map(int fd) in print_ip_map() argument
100 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_ip_map()
101 bpf_map_lookup_elem(fd, &next_key, &value); in print_ip_map()
Dtrace_event_user.c105 int error = 1, fd = map_fd[0], stack_map = map_fd[1]; in print_stacks() local
108 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_stacks()
109 bpf_map_lookup_elem(fd, &next_key, &value); in print_stacks()
111 bpf_map_delete_elem(fd, &next_key); in print_stacks()
Dlathist_user.c61 static void get_data(int fd) in get_data() argument
72 bpf_map_lookup_elem(fd, &key, &value); in get_data()
/samples/uhid/
Duhid-example.c159 static int uhid_write(int fd, const struct uhid_event *ev) in uhid_write() argument
163 ret = write(fd, ev, sizeof(*ev)); in uhid_write()
176 static int create(int fd) in create() argument
191 return uhid_write(fd, &ev); in create()
194 static void destroy(int fd) in destroy() argument
201 uhid_write(fd, &ev); in destroy()
225 static int event(int fd) in event() argument
231 ret = read(fd, &ev, sizeof(ev)); in event()
278 static int send_event(int fd) in send_event() argument
298 return uhid_write(fd, &ev); in send_event()
[all …]
/samples/hidraw/
Dhid-example.c45 int fd; in main() local
57 fd = open(device, O_RDWR|O_NONBLOCK); in main()
59 if (fd < 0) { in main()
69 res = ioctl(fd, HIDIOCGRDESCSIZE, &desc_size); in main()
77 res = ioctl(fd, HIDIOCGRDESC, &rpt_desc); in main()
88 res = ioctl(fd, HIDIOCGRAWNAME(256), buf); in main()
95 res = ioctl(fd, HIDIOCGRAWPHYS(256), buf); in main()
102 res = ioctl(fd, HIDIOCGRAWINFO, &info); in main()
118 res = ioctl(fd, HIDIOCSFEATURE(4), buf); in main()
126 res = ioctl(fd, HIDIOCGFEATURE(256), buf); in main()
[all …]
/samples/watchdog/
Dwatchdog-simple.c9 int fd = open("/dev/watchdog", O_WRONLY); in main() local
11 if (fd == -1) { in main()
16 ret = write(fd, "\0", 1); in main()
23 close(fd); in main()
/samples/watch_queue/
Dwatch_test.c64 static void consumer(int fd) in consumer() argument
74 buf_len = read(fd, buffer, sizeof(buffer)); in consumer()
156 int pipefd[2], fd; in main() local
162 fd = pipefd[0]; in main()
164 if (ioctl(fd, IOC_WATCH_QUEUE_SET_SIZE, BUF_SIZE) == -1) { in main()
169 if (ioctl(fd, IOC_WATCH_QUEUE_SET_FILTER, &filter) == -1) { in main()
174 if (keyctl_watch_key(KEY_SPEC_SESSION_KEYRING, fd, 0x01) == -1) { in main()
179 if (keyctl_watch_key(KEY_SPEC_USER_KEYRING, fd, 0x02) == -1) { in main()
184 consumer(fd); in main()
/samples/vfs/
Dtest-fsmount.c20 static void check_messages(int fd) in check_messages() argument
28 n = read(fd, buf, sizeof(buf)); in check_messages()
50 void mount_error(int fd, const char *s) in mount_error() argument
52 check_messages(fd); in mount_error()
97 #define E_fsconfig(fd, cmd, key, val, aux) \ argument
99 if (fsconfig(fd, cmd, key, val, aux) == -1) \
100 mount_error(fd, key ?: "create"); \
/samples/binderfs/
Dbinderfs_example.c20 int fd, ret, saved_errno; in main() local
53 fd = open("/dev/binderfs/binder-control", O_RDONLY | O_CLOEXEC); in main()
54 if (fd < 0) { in main()
60 ret = ioctl(fd, BINDER_CTL_ADD, &device); in main()
62 close(fd); in main()
/samples/mei/
Dmei-amt-version.c98 int fd; member
103 if (cl->fd != -1) in mei_deinit()
104 close(cl->fd); in mei_deinit()
105 cl->fd = -1; in mei_deinit()
120 me->fd = open("/dev/mei0", O_RDWR); in mei_init()
121 if (me->fd == -1) { in mei_init()
130 result = ioctl(me->fd, IOCTL_MEI_CONNECT_CLIENT, &data); in mei_init()
167 FD_SET(me->fd, &set); in mei_recv_msg()
168 rc = select(me->fd + 1, &set, NULL, NULL, &tv); in mei_recv_msg()
169 if (rc > 0 && FD_ISSET(me->fd, &set)) { in mei_recv_msg()
[all …]

12