/openbmc/linux/tools/testing/selftests/net/ |
H A D | psock_fanout.c | 235 static int sock_fanout_read(int fds[], char *rings[], const int expect[]) in sock_fanout_read() argument 239 ret[0] = sock_fanout_read_ring(fds[0], rings[0]); in sock_fanout_read() 240 ret[1] = sock_fanout_read_ring(fds[1], rings[1]); in sock_fanout_read() 269 int fds[2]; in test_control_group() local 273 fds[0] = sock_fanout_open(PACKET_FANOUT_HASH, 0); in test_control_group() 274 if (fds[0] == -1) { in test_control_group() 292 fds[1] = sock_fanout_open(PACKET_FANOUT_HASH, 0); 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 [all …]
|
H A D | psock_lib.h | 77 static __maybe_unused void pair_udp_open(int fds[], uint16_t port) in pair_udp_open() argument 81 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() 113 static __maybe_unused void pair_udp_send_char(int fds[], int num, char payload) in pair_udp_send_char() argument 120 if (write(fds[0], buf, sizeof(buf)) != sizeof(buf)) { in pair_udp_send_char() 124 if (read(fds[1], rbuf, sizeof(rbuf)) != sizeof(rbuf)) { in pair_udp_send_char() [all …]
|
/openbmc/qemu/hw/remote/ |
H A D | mpqemu-link.c | 39 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 D | common.c | 806 static int prog_fd_by_nametag(void *nametag, int **fds, bool tag) in prog_fd_by_nametag() argument 856 tmp = realloc(*fds, (nb_fds + 1) * sizeof(int)); in prog_fd_by_nametag() 861 *fds = tmp; in prog_fd_by_nametag() 863 (*fds)[nb_fds++] = fd; in prog_fd_by_nametag() 870 close((*fds)[nb_fds]); in prog_fd_by_nametag() 874 int prog_parse_fds(int *argc, char ***argv, int **fds) in prog_parse_fds() argument 889 (*fds)[0] = bpf_prog_get_fd_by_id(id); in prog_parse_fds() 890 if ((*fds)[0] < 0) { in prog_parse_fds() 908 return prog_fd_by_nametag(tag, fds, true); in prog_parse_fds() 921 return prog_fd_by_nametag(name, fds, false); in prog_parse_fds() [all …]
|
/openbmc/linux/fs/ |
H A D | select.c | 414 #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 420 static int max_select_fd(unsigned long n, fd_set_bits *fds) in max_select_fd() argument 434 set &= BITS(fds, n); in max_select_fd() 444 set = BITS(fds, n); in max_select_fd() 479 static noinline_for_stack int do_select(int n, fd_set_bits *fds, struct timespec64 *end_time) in do_select() argument 490 retval = max_select_fd(n, fds); in do_select() 512 inp = fds->in; outp = fds->out; exp = fds->ex; in do_select() [all …]
|
/openbmc/linux/arch/um/os-Linux/ |
H A D | helper.c | 47 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()
|
H A D | sigio.c | 53 struct pollfds *fds, tmp; in write_sigio_thread() local 59 fds = ¤t_poll; in write_sigio_thread() 61 n = poll(fds->poll, fds->used, -1); in write_sigio_thread() 68 for (i = 0; i < fds->used; i++) { in write_sigio_thread() 69 p = &fds->poll[i]; in write_sigio_thread() 87 fds->used--; in write_sigio_thread() 88 memmove(&fds->poll[i], &fds->poll[i + 1], in write_sigio_thread() 89 (fds->used - i) * sizeof(*fds->poll)); in write_sigio_thread()
|
/openbmc/qemu/util/ |
H A D | event_notifier-posix.c | 37 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()
|
/openbmc/linux/arch/um/drivers/ |
H A D | ubd_user.c | 30 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 D | slirp_user.c | 52 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 D | slip_user.c | 78 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/btbridge/ |
H A D | btbridged.c | 78 struct pollfd fds[TOTAL_FDS]; member 270 r = ioctl(bt_fd->fds[BT_FD].fd, BT_BMC_IOCTL_SMS_ATN); in method_send_sms_atn() 273 MSG_ERR("Couldn't ioctl() to 0x%x, %s: %s\n", bt_fd->fds[BT_FD].fd, BT_BMC_PATH, strerror(r)); in method_send_sms_atn() 334 context->fds[BT_FD].events |= POLLOUT; in method_send_message() 367 r = timerfd_settime(context->fds[TIMER_FD].fd, TFD_TIMER_ABSTIME, &ts, NULL); in bt_host_write() 384 len = write(context->fds[BT_FD].fd, data, data[0] + 1); in bt_host_write() 429 context->fds[BT_FD].events = POLLIN; in bt_host_write() 438 if (context->fds[TIMER_FD].revents & POLLIN) { in dispatch_timer() 444 r = read(context->fds[TIMER_FD].fd, &counter, sizeof(counter)); in dispatch_timer() 479 context->fds[BT_FD].events |= POLLOUT; in dispatch_timer() [all …]
|
/openbmc/linux/Documentation/translations/zh_CN/accounting/ |
H A D | psi.rst | 109 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/bpf/ |
H A D | network_helpers.c | 152 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() 164 fds[0] = __start_server(type, 0, (struct sockaddr *)&addr, addrlen, in start_reuseport_server() 166 if (fds[0] == -1) in start_reuseport_server() 170 if (getsockname(fds[0], (struct sockaddr *)&addr, &addrlen)) in start_reuseport_server() 174 fds[nr_fds] = __start_server(type, 0, (struct sockaddr *)&addr, 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() [all …]
|
/openbmc/linux/tools/testing/selftests/pidfd/ |
H A D | pidfd_poll_test.c | 28 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/linux/tools/testing/selftests/bpf/benchs/ |
H A D | bench_local_storage_create.c | 13 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/linux/samples/nitro_enclaves/ |
H A D | ne_ioctl_sample.c | 199 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() 228 printf("Poll received value 0x%x\n", fds[0].revents); 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() [all …]
|
/openbmc/qemu/contrib/ivshmem-client/ |
H A D | main.c | 135 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/phosphor-ipmi-flash/bmc/firmware-handler/ |
H A D | net_handler.cpp | 74 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/phosphor-mboxd/ |
H A D | mboxd_flash.c | 53 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 D | mboxd.c | 59 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/linux/tools/perf/bench/ |
H A D | sched-messaging.c | 58 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 D | libqmp.c | 99 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()
|
/openbmc/qemu/tests/tcg/multiarch/linux/ |
H A D | linux-test.c | 333 int fds[2], fd_max, ret; in test_pipe() local 337 chk_error(pipe(fds)); in test_pipe() 338 chk_error(fcntl(fds[0], F_SETFL, O_NONBLOCK)); in test_pipe() 339 chk_error(fcntl(fds[1], F_SETFL, O_NONBLOCK)); in test_pipe() 344 fd_max = fds[0]; in test_pipe() 345 FD_SET(fds[0], &rfds); in test_pipe() 348 FD_SET(fds[1], &wfds); in test_pipe() 349 if (fds[1] > fd_max) in test_pipe() 350 fd_max = fds[1]; in test_pipe() 354 if (FD_ISSET(fds[0], &rfds)) { in test_pipe() [all …]
|
/openbmc/qemu/io/ |
H A D | channel.c | 54 int **fds, in qio_channel_readv_full() argument 61 if ((fds || nfds) && in qio_channel_readv_full() 75 return klass->io_readv(ioc, iov, niov, fds, nfds, flags, errp); in qio_channel_readv_full() 82 int *fds, in qio_channel_writev_full() argument 89 if (fds || nfds) { in qio_channel_writev_full() 109 return klass->io_writev(ioc, iov, niov, fds, nfds, flags, errp); in qio_channel_writev_full() 132 int **fds, size_t *nfds, in qio_channel_readv_full_all_eof() argument 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() [all …]
|