/* Protected by sigio_lock(). Used by the sigio thread, but the UML thread
* synchronizes with it.
*/
-static struct pollfds current_poll = {
+struct pollfds current_poll = {
.poll = NULL,
.size = 0,
.used = 0
};
-static struct pollfds next_poll = {
+struct pollfds next_poll = {
.poll = NULL,
.size = 0,
.used = 0
set_signals(flags);
}
-static int add_sigio_fd(int fd, int read)
+int add_sigio_fd(int fd, int read)
{
int err = 0, i, n, events;
struct pollfd *p;
int err = 0, i, n = 0;
- /* This is called from exitcalls elsewhere in UML - if
- * sigio_cleanup has already run, then update_thread will hang
- * or fail because the thread is no longer running.
- */
- if(write_sigio_pid == -1)
- return -EIO;
-
sigio_lock();
for(i = 0; i < current_poll.used; i++){
if(current_poll.poll[i].fd == fd) break;
update_thread();
out:
sigio_unlock();
- return err;
+ return(err);
}
static struct pollfd *setup_initial_poll(int fd)
return p;
}
-static void write_sigio_workaround(void)
+void write_sigio_workaround(void)
{
unsigned long stack;
struct pollfd *p;
close(l_write_sigio_fds[1]);
}
-void maybe_sigio_broken(int fd, int read)
-{
- if(!isatty(fd))
- return;
-
- if((read || pty_output_sigio) && (!read || pty_close_sigio))
- return;
-
- write_sigio_workaround();
- add_sigio_fd(fd, read);
-}
-
-static void sigio_cleanup(void)
+void sigio_cleanup(void)
{
if(write_sigio_pid != -1){
os_kill_process(write_sigio_pid, 1);
write_sigio_pid = -1;
}
}
-
-__uml_exitcall(sigio_cleanup);