Lines Matching +full:no +full:- +full:poll +full:- +full:on +full:- +full:init

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2002 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
9 #include <poll.h>
15 #include <init.h>
24 static int write_sigio_pid = -1;
30 * On the UML side, they are changed under the sigio_lock.
32 #define SIGIO_FDS_INIT {-1, -1}
38 struct pollfd *poll; member
61 n = poll(fds->poll, fds->used, -1); in write_sigio_thread()
65 printk(UM_KERN_ERR "write_sigio_thread : poll returned " 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()
70 if (p->revents == 0) in write_sigio_thread()
72 if (p->fd == sigio_private[1]) { in write_sigio_thread()
78 "read on socket failed, " 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()
95 "write on socket failed, err = %d\n", in write_sigio_thread()
107 if (n <= polls->size) in need_poll()
114 return -ENOMEM; in need_poll()
117 memcpy(new, polls->poll, polls->used * sizeof(struct pollfd)); in need_poll()
118 kfree(polls->poll); in need_poll()
120 polls->poll = new; in need_poll()
121 polls->size = n; in need_poll()
154 if (write_sigio_pid != -1) { in update_thread()
158 write_sigio_pid = -1; in update_thread()
173 if (all_sigio_fds.poll[i].fd == fd) in __add_sigio_fd()
177 return -ENOSPC; in __add_sigio_fd()
179 p = &all_sigio_fds.poll[i]; in __add_sigio_fd()
182 if (current_poll.poll[i].fd == fd) in __add_sigio_fd()
191 memcpy(next_poll.poll, current_poll.poll, in __add_sigio_fd()
193 next_poll.poll[n] = *p; in __add_sigio_fd()
218 * This is called from exitcalls elsewhere in UML - if in __ignore_sigio_fd()
220 * or fail because the thread is no longer running. in __ignore_sigio_fd()
222 if (write_sigio_pid == -1) in __ignore_sigio_fd()
223 return -EIO; in __ignore_sigio_fd()
226 if (current_poll.poll[i].fd == fd) in __ignore_sigio_fd()
230 return -ENOENT; in __ignore_sigio_fd()
232 err = need_poll(&next_poll, current_poll.used - 1); in __ignore_sigio_fd()
237 p = &current_poll.poll[i]; in __ignore_sigio_fd()
238 if (p->fd != fd) in __ignore_sigio_fd()
239 next_poll.poll[n++] = *p; in __ignore_sigio_fd()
241 next_poll.used = current_poll.used - 1; in __ignore_sigio_fd()
266 "poll\n"); in setup_initial_poll()
283 /* We call this *tons* of times - and most ones we must just fail. */ in write_sigio_workaround()
288 if (l_write_sigio_pid != -1) in write_sigio_workaround()
293 printk(UM_KERN_ERR "write_sigio_workaround - os_pipe 1 failed, " in write_sigio_workaround()
294 "err = %d\n", -err); in write_sigio_workaround()
299 printk(UM_KERN_ERR "write_sigio_workaround - os_pipe 2 failed, " in write_sigio_workaround()
300 "err = %d\n", -err); in write_sigio_workaround()
312 * to happen, and no more than once at the boot. in write_sigio_workaround()
314 if (write_sigio_pid != -1) in write_sigio_workaround()
317 current_poll = ((struct pollfds) { .poll = p, in write_sigio_workaround()
338 write_sigio_pid = -1; in write_sigio_workaround()
339 write_sigio_fds[0] = -1; in write_sigio_workaround()
340 write_sigio_fds[1] = -1; in write_sigio_workaround()
341 sigio_private[0] = -1; in write_sigio_workaround()
342 sigio_private[1] = -1; in write_sigio_workaround()
344 current_poll = ((struct pollfds) { .poll = NULL, in write_sigio_workaround()
367 printk(UM_KERN_ERR "maybe_sigio_broken - failed to add pollfd " in sigio_broken()
372 all_sigio_fds.poll[all_sigio_fds.used++] = in sigio_broken()
396 if (write_sigio_pid == -1) in sigio_cleanup()
401 write_sigio_pid = -1; in sigio_cleanup()
424 info->err = 0; in openpty_cb()
425 if (openpty(&info->master, &info->slave, NULL, NULL, NULL)) in openpty_cb()
426 info->err = -errno; in openpty_cb()
435 return -errno; in async_pty()
439 return -errno; in async_pty()
442 return -errno; in async_pty()
450 struct openpty_arg pty = { .master = -1, .slave = -1 }; in check_one_sigio()
456 -pty.err); in check_one_sigio()
463 if ((master == -1) || (slave == -1)) { in check_one_sigio()
473 -err); in check_one_sigio()
480 "err = %d\n", -err); in check_one_sigio()
529 } else if (n == -EAGAIN) in tty_output()
530 printk(UM_KERN_CONT "No, enabling workaround\n"); in tty_output()
539 printk(UM_KERN_WARNING "No pseudo-terminals available - " in check_sigio()