Home
last modified time | relevance | path

Searched refs:fds (Results 1 – 25 of 218) sorted by relevance

123456789

/openbmc/linux/tools/testing/selftests/net/
H A Dpsock_fanout.c269 int fds[2]; in test_control_group() local
274 if (fds[0] == -1) { in test_control_group()
293 if (fds[1] == -1) { in test_control_group()
297 if (close(fds[1]) || close(fds[0])) { in test_control_group()
306 int fds[3]; in test_control_group_max_num_members() local
319 if (fds[0] == -1) { in test_control_group_max_num_members()
347 if (close(fds[2]) || close(fds[1]) || close(fds[0])) { in test_control_group_max_num_members()
356 int fds[3]; in test_unique_fanout_group_ids() local
402 if (close(fds[0]) || close(fds[1]) || close(fds[2])) { in test_unique_fanout_group_ids()
422 if (fds[0] == -1 || fds[1] == -1) { in test_datapath()
[all …]
H A Dpsock_lib.h81 fds[0] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
82 fds[1] = socket(PF_INET, SOCK_DGRAM, 0); in pair_udp_open()
83 if (fds[0] == -1 || fds[1] == -1) { in pair_udp_open()
99 if (bind(fds[1], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
103 if (bind(fds[0], (void *) &saddr, sizeof(saddr))) { in pair_udp_open()
107 if (connect(fds[0], (void *) &daddr, sizeof(daddr))) { in pair_udp_open()
120 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) { in pair_udp_send_char()
137 return pair_udp_send_char(fds, num, DATA_CHAR); in pair_udp_send()
140 static __maybe_unused void pair_udp_close(int fds[]) in pair_udp_close() argument
142 close(fds[0]); in pair_udp_close()
[all …]
/openbmc/qemu/hw/remote/
H A Dmpqemu-link.c39 int *fds = NULL; in mpqemu_msg_send() local
51 fds = msg->fds; in mpqemu_msg_send()
71 fds, nfds, 0, errp)) { in mpqemu_msg_send()
95 static ssize_t mpqemu_read(QIOChannel *ioc, void *buf, size_t len, int **fds, in mpqemu_read() argument
113 ret = qio_channel_readv_full_all_eof(ioc, &iov, 1, fds, nfds, errp); in mpqemu_read()
125 g_autofree int *fds = NULL; in mpqemu_msg_recv() local
130 len = mpqemu_read(ioc, msg, MPQEMU_MSG_HDR_SIZE, &fds, &nfds, errp); in mpqemu_msg_recv()
158 if (nfds > G_N_ELEMENTS(msg->fds)) { in mpqemu_msg_recv()
165 memcpy(msg->fds, fds, nfds * sizeof(int)); in mpqemu_msg_recv()
175 close(fds[nfds - 1]); in mpqemu_msg_recv()
[all …]
/openbmc/linux/tools/bpf/bpftool/
H A Dcommon.c861 *fds = tmp; in prog_fd_by_nametag()
931 if ((*fds)[0] < 0) in prog_parse_fds()
942 int *fds = NULL; in prog_parse_fd() local
946 if (!fds) { in prog_parse_fd()
961 fd = fds[0]; in prog_parse_fd()
963 free(fds); in prog_parse_fd()
1012 *fds = tmp; in map_fd_by_name()
1079 int *fds = NULL; in map_parse_fd() local
1083 if (!fds) { in map_parse_fd()
1098 fd = fds[0]; in map_parse_fd()
[all …]
/openbmc/qemu/util/
H A Devent_notifier-posix.c37 int fds[2]; in event_notifier_init() local
52 if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { in event_notifier_init()
55 if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) { in event_notifier_init()
59 if (!g_unix_set_fd_nonblocking(fds[1], true, NULL)) { in event_notifier_init()
63 e->rfd = fds[0]; in event_notifier_init()
64 e->wfd = fds[1]; in event_notifier_init()
73 close(fds[0]); in event_notifier_init()
74 close(fds[1]); in event_notifier_init()
H A Dcompatfd.c59 int fds[2]; in qemu_signalfd_compat() local
63 if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { in qemu_signalfd_compat()
69 info->fd = fds[1]; in qemu_signalfd_compat()
74 return fds[0]; in qemu_signalfd_compat()
/openbmc/linux/arch/um/os-Linux/
H A Dhelper.c47 int pid, fds[2], ret, n; in run_helper() local
53 ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fds); in run_helper()
61 ret = os_set_exec_close(fds[1]); in run_helper()
72 data.fd = fds[1]; in run_helper()
83 close(fds[1]); in run_helper()
84 fds[1] = -1; in run_helper()
90 n = read(fds[0], &ret, sizeof(ret)); in run_helper()
110 if (fds[1] != -1) in run_helper()
111 close(fds[1]); in run_helper()
112 close(fds[0]); in run_helper()
/openbmc/linux/fs/
H A Dselect.c414 #define FDS_IN(fds, n) (fds->in + n) argument
415 #define FDS_OUT(fds, n) (fds->out + n) argument
416 #define FDS_EX(fds, n) (fds->ex + n) argument
418 #define BITS(fds, n) (*FDS_IN(fds, n)|*FDS_OUT(fds, n)|*FDS_EX(fds, n)) argument
434 set &= BITS(fds, n); in max_select_fd()
444 set = BITS(fds, n); in max_select_fd()
512 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select()
513 rinp = fds->res_in; routp = fds->res_out; rexp = fds->res_ex; in do_select()
628 fd_set_bits fds; in core_sys_select() local
666 fds.in = bits; in core_sys_select()
[all …]
/openbmc/linux/arch/um/drivers/
H A Dubd_user.c30 int pid, fds[2], err; in start_io_thread() local
32 err = os_pipe(fds, 1, 1); in start_io_thread()
38 kernel_fd = fds[0]; in start_io_thread()
41 *fd_out = fds[1]; in start_io_thread()
60 os_close_file(fds[0]); in start_io_thread()
61 os_close_file(fds[1]); in start_io_thread()
H A Dslirp_user.c52 int fds[2], pid, err; in slirp_open() local
54 err = os_pipe(fds, 1, 1); in slirp_open()
58 err = slirp_tramp(pri->argw.argv, fds[1]); in slirp_open()
65 pri->slave = fds[1]; in slirp_open()
70 return fds[0]; in slirp_open()
72 close(fds[0]); in slirp_open()
73 close(fds[1]); in slirp_open()
H A Dslip_user.c78 int pid, fds[2], err, output_len; in slip_tramp() local
80 err = os_pipe(fds, 1, 0); in slip_tramp()
89 pe_data.stdout_fd = fds[1]; in slip_tramp()
90 pe_data.close_me = fds[0]; in slip_tramp()
106 close(fds[1]); in slip_tramp()
107 read_output(fds[0], output, output_len); in slip_tramp()
111 close(fds[0]); in slip_tramp()
117 close(fds[0]); in slip_tramp()
118 close(fds[1]); in slip_tramp()
/openbmc/qemu/contrib/rdmacm-mux/
H A Dmain.c71 struct pollfd fds[MAX_CLIENTS]; member
533 if (!server.fds[i].fd) { in compress_fds()
536 server.fds[j] = server.fds[j + 1]; in compress_fds()
548 close(server.fds[idx].fd); in close_fd()
551 server.fds[idx].fd = 0; in close_fd()
577 server.fds[i].revents, server.fds[i].events); in run()
618 if (server.fds[0].fd <= 0) { in fini_listener()
623 if (server.fds[i].fd) { in fini_listener()
663 if (server.fds[0].fd < 0) { in init_listener()
714 server.fds[0].events = POLLIN; in init_listener()
[all …]
/openbmc/linux/Documentation/translations/zh_CN/accounting/
H A Dpsi.rst109 struct pollfd fds;
112 fds.fd = open("/proc/pressure/memory", O_RDWR | O_NONBLOCK);
113 if (fds.fd < 0) {
118 fds.events = POLLPRI;
120 if (write(fds.fd, trig, strlen(trig) + 1) < 0) {
128 n = poll(&fds, 1, -1);
133 if (fds.revents & POLLERR) {
137 if (fds.revents & POLLPRI) {
140 printf("unknown event received: 0x%x\n", fds.revents);
/openbmc/linux/tools/testing/selftests/pidfd/
H A Dpidfd_poll_test.c28 struct pollfd fds; in main() local
32 fds.events = POLLIN; in main()
85 fds.fd = pidfd; in main()
86 nevents = poll(&fds, 1, -1); in main()
97 if (!(fds.revents & POLLIN)) in main()
100 fds.revents); in main()
/openbmc/btbridge/
H A Dbtbridged.c78 struct pollfd fds[TOTAL_FDS]; member
334 context->fds[BT_FD].events |= POLLOUT; in method_send_message()
429 context->fds[BT_FD].events = POLLIN; in bt_host_write()
479 context->fds[BT_FD].events |= POLLOUT; in dispatch_timer()
488 if (context->fds[SD_BUS_FD].revents) { in dispatch_sd_bus()
699 if (context->fds[SD_BUS_FD].fd < 0) { in main()
707 if (context->fds[BT_FD].fd < 0) { in main()
715 if (context->fds[TIMER_FD].fd < 0) { in main()
721 context->fds[BT_FD].events = POLLIN; in main()
757 close(context->fds[BT_FD].fd); in main()
[all …]
/openbmc/linux/tools/testing/selftests/bpf/
H A Dnetwork_helpers.c152 int *fds; in start_reuseport_server() local
160 fds = malloc(sizeof(*fds) * nr_listens); in start_reuseport_server()
161 if (!fds) in start_reuseport_server()
166 if (fds[0] == -1) in start_reuseport_server()
176 if (fds[nr_fds] == -1) in start_reuseport_server()
180 return fds; in start_reuseport_server()
183 free_fds(fds, nr_fds); in start_reuseport_server()
187 void free_fds(int *fds, unsigned int nr_close_fds) in free_fds() argument
189 if (fds) { in free_fds()
191 close(fds[--nr_close_fds]); in free_fds()
[all …]
/openbmc/linux/tools/testing/selftests/bpf/benchs/
H A Dbench_local_storage_create.c13 int *fds; member
120 t->fds = malloc(batch_sz * sizeof(*t->fds)); in setup()
121 if (!t->fds) { in setup()
149 int *fds = t->fds; in sk_producer() local
154 fds[i] = socket(AF_INET6, SOCK_DGRAM, 0); in sk_producer()
155 if (fds[i] == -1) in sk_producer()
160 if (fds[i] != -1) in sk_producer()
161 close(fds[i]); in sk_producer()
/openbmc/phosphor-ipmi-flash/bmc/firmware-handler/
H A Dnet_handler.cpp74 struct pollfd fds; in copyFrom() local
75 fds.fd = *listenFd; in copyFrom()
76 fds.events = POLLIN; in copyFrom()
78 int ret = ::poll(&fds, 1, timeoutS * 1000); in copyFrom()
89 else if (fds.revents != POLLIN) in copyFrom()
91 fprintf(stderr, "Invalid poll state: 0x%x\n", fds.revents); in copyFrom()
/openbmc/qemu/contrib/ivshmem-client/
H A Dmain.c135 fd_set fds; in ivshmem_client_poll_events() local
140 FD_ZERO(&fds); in ivshmem_client_poll_events()
141 FD_SET(0, &fds); /* add stdin in fd_set */ in ivshmem_client_poll_events()
144 ivshmem_client_get_fds(client, &fds, &maxfd); in ivshmem_client_poll_events()
146 ret = select(maxfd, &fds, NULL, NULL, NULL); in ivshmem_client_poll_events()
159 if (FD_ISSET(0, &fds) && in ivshmem_client_poll_events()
165 if (ivshmem_client_handle_fds(client, &fds, maxfd) < 0) { in ivshmem_client_poll_events()
/openbmc/linux/samples/nitro_enclaves/
H A Dne_ioctl_sample.c199 struct pollfd fds[1] = {}; in ne_poll_enclave_fd() local
205 fds[0].fd = enclave_fd; in ne_poll_enclave_fd()
206 fds[0].events = POLLIN | POLLERR | POLLHUP; in ne_poll_enclave_fd()
212 rc = poll(fds, 1, NE_POLL_WAIT_TIME_MS); in ne_poll_enclave_fd()
230 if (fds[0].revents & POLLHUP) { in ne_poll_enclave_fd()
236 if (fds[0].revents & POLLNVAL) { in ne_poll_enclave_fd()
656 struct pollfd fds[1] = {}; in ne_start_enclave_check_booted() local
696 fds[0].fd = server_vsock_fd; in ne_start_enclave_check_booted()
697 fds[0].events = POLLIN; in ne_start_enclave_check_booted()
699 rc = poll(fds, 1, NE_POLL_WAIT_TIME_MS); in ne_start_enclave_check_booted()
[all …]
/openbmc/phosphor-mboxd/
H A Dmboxd_flash.c53 context->fds[MTD_FD].fd = fd; in init_flash_dev()
103 close(context->fds[MTD_FD].fd); in free_flash_dev()
184 rc = ioctl(context->fds[MTD_FD].fd, MEMERASE, in erase_flash()
205 rc = ioctl(context->fds[MTD_FD].fd, MEMERASE, &erase_info); in erase_flash()
239 if (lseek(context->fds[MTD_FD].fd, offset, SEEK_SET) != offset) { in copy_flash()
246 size_read = read(context->fds[MTD_FD].fd, mem, in copy_flash()
278 if (lseek(context->fds[MTD_FD].fd, offset, SEEK_SET) != offset) { in write_flash()
285 rc = write(context->fds[MTD_FD].fd, buf + buf_offset, count); in write_flash()
H A Dmboxd.c59 context->fds[i].events = POLLIN; in poll_loop()
63 rc = poll(context->fds, POLL_FDS, -1); in poll_loop()
71 if (context->fds[SIG_FD].revents & POLLIN) { /* Signal */ in poll_loop()
74 rc = read(context->fds[SIG_FD].fd, (void *) &info, in poll_loop()
105 if (context->fds[DBUS_FD].revents & POLLIN) { /* DBUS */ in poll_loop()
117 if (context->fds[MBOX_FD].revents & POLLIN) { /* MBOX */ in poll_loop()
161 context->fds[SIG_FD].fd = rc; in init_signals()
294 context->fds[i].fd = -1; in main()
/openbmc/qemu/io/
H A Dchannel.c54 int **fds, in qio_channel_readv_full() argument
61 if ((fds || nfds) && in qio_channel_readv_full()
89 if (fds || nfds) { in qio_channel_writev_full()
139 int **local_fds = fds; in qio_channel_readv_full_all_eof()
147 if (fds) { in qio_channel_readv_full_all_eof()
148 *fds = NULL; in qio_channel_readv_full_all_eof()
190 if (nfds && fds) { in qio_channel_readv_full_all_eof()
193 close((*fds)[i]); in qio_channel_readv_full_all_eof()
195 g_free(*fds); in qio_channel_readv_full_all_eof()
196 *fds = NULL; in qio_channel_readv_full_all_eof()
[all …]
/openbmc/linux/tools/perf/bench/
H A Dsched-messaging.c58 static void fdpair(int fds[2]) in fdpair()
61 if (pipe(fds) == 0) in fdpair()
64 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0) in fdpair()
212 int fds[2]; in group() local
221 fdpair(fds); in group()
224 ctx->in_fds[0] = fds[0]; in group()
225 ctx->in_fds[1] = fds[1]; in group()
231 snd_ctx->out_fds[i] = fds[1]; in group()
233 close(fds[0]); in group()
/openbmc/qemu/tests/qtest/
H A Dlibqmp.c99 static void socket_send_fds(int socket_fd, int *fds, size_t fds_num, in socket_send_fds() argument
112 if (fds && fds_num > 0) { in socket_send_fds()
122 memcpy(CMSG_DATA(cmsg), fds, fdsize); in socket_send_fds()
138 _qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, in _qmp_fd_vsend_fds() argument
167 if (fds && fds_num > 0) { in _qmp_fd_vsend_fds()
168 socket_send_fds(fd, fds, fds_num, str->str, str->len); in _qmp_fd_vsend_fds()
181 void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, in qmp_fd_vsend_fds() argument
184 _qmp_fd_vsend_fds(fd, fds, fds_num, fmt, ap); in qmp_fd_vsend_fds()

123456789