Merge git://github.com/rustyrussell/linux
[pandora-kernel.git] / arch / um / drivers / chan_user.c
index b88e93b..f180813 100644 (file)
@@ -13,7 +13,6 @@
 #include "chan_user.h"
 #include "os.h"
 #include "um_malloc.h"
-#include "user.h"
 
 void generic_close(int fd, void *unused)
 {
@@ -74,10 +73,16 @@ void generic_free(void *data)
 
 int generic_console_write(int fd, const char *buf, int n)
 {
+       sigset_t old, no_sigio;
        struct termios save, new;
        int err;
 
        if (isatty(fd)) {
+               sigemptyset(&no_sigio);
+               sigaddset(&no_sigio, SIGIO);
+               if (sigprocmask(SIG_BLOCK, &no_sigio, &old))
+                       goto error;
+
                CATCH_EINTR(err = tcgetattr(fd, &save));
                if (err)
                        goto error;
@@ -97,8 +102,11 @@ int generic_console_write(int fd, const char *buf, int n)
         * Restore raw mode, in any case; we *must* ignore any error apart
         * EINTR, except for debug.
         */
-       if (isatty(fd))
+       if (isatty(fd)) {
                CATCH_EINTR(tcsetattr(fd, TCSAFLUSH, &save));
+               sigprocmask(SIG_SETMASK, &old, NULL);
+       }
+
        return err;
 error:
        return -errno;
@@ -273,7 +281,12 @@ void register_winch(int fd, struct tty_struct *tty)
                return;
 
        pid = tcgetpgrp(fd);
-       if (!is_skas_winch(pid, fd, tty) && (pid == -1)) {
+       if (is_skas_winch(pid, fd, tty)) {
+               register_winch_irq(-1, fd, -1, tty, 0);
+               return;
+       }
+
+       if (pid == -1) {
                thread = winch_tramp(fd, tty, &thread_fd, &stack);
                if (thread < 0)
                        return;