diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-07-10 07:45:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:24 -0400 |
commit | 8e64d96aeb495709c13307e2d79f3ee37e96aa4e (patch) | |
tree | 41532136fdd081d561343be876d3068464821910 /arch | |
parent | bfaafd7184f044c63cd937cb0ffb4334b4ec7635 (diff) |
[PATCH] uml: remove os_isatty
os_isatty can be made to disappear by moving maybe_sigio_broken from kernel to
user code. This also lets write_sigio_workaround become static.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/include/os.h | 3 | ||||
-rw-r--r-- | arch/um/kernel/irq.c | 17 | ||||
-rw-r--r-- | arch/um/os-Linux/irq.c | 5 | ||||
-rw-r--r-- | arch/um/os-Linux/sigio.c | 14 |
4 files changed, 16 insertions, 23 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 700f7a76c822..548f6ddd8597 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -318,7 +318,6 @@ extern void reboot_skas(void); | |||
318 | 318 | ||
319 | /* irq.c */ | 319 | /* irq.c */ |
320 | extern int os_waiting_for_events(struct irq_fd *active_fds); | 320 | extern int os_waiting_for_events(struct irq_fd *active_fds); |
321 | extern int os_isatty(int fd); | ||
322 | extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds); | 321 | extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds); |
323 | extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, | 322 | extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, |
324 | struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2); | 323 | struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2); |
@@ -330,9 +329,9 @@ extern void os_set_ioignore(void); | |||
330 | extern void init_irq_signals(int on_sigstack); | 329 | extern void init_irq_signals(int on_sigstack); |
331 | 330 | ||
332 | /* sigio.c */ | 331 | /* sigio.c */ |
333 | extern void write_sigio_workaround(void); | ||
334 | extern int add_sigio_fd(int fd, int read); | 332 | extern int add_sigio_fd(int fd, int read); |
335 | extern int ignore_sigio_fd(int fd); | 333 | extern int ignore_sigio_fd(int fd); |
334 | extern void maybe_sigio_broken(int fd, int read); | ||
336 | 335 | ||
337 | /* skas/trap */ | 336 | /* skas/trap */ |
338 | extern void sig_handler_common_skas(int sig, void *sc_ptr); | 337 | extern void sig_handler_common_skas(int sig, void *sc_ptr); |
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c index 27bc58ad38fd..589c69a75043 100644 --- a/arch/um/kernel/irq.c +++ b/arch/um/kernel/irq.c | |||
@@ -110,19 +110,6 @@ void sigio_handler(int sig, union uml_pt_regs *regs) | |||
110 | free_irqs(); | 110 | free_irqs(); |
111 | } | 111 | } |
112 | 112 | ||
113 | static void maybe_sigio_broken(int fd, int type) | ||
114 | { | ||
115 | if (os_isatty(fd)) { | ||
116 | if ((type == IRQ_WRITE) && !pty_output_sigio) { | ||
117 | write_sigio_workaround(); | ||
118 | add_sigio_fd(fd, 0); | ||
119 | } else if ((type == IRQ_READ) && !pty_close_sigio) { | ||
120 | write_sigio_workaround(); | ||
121 | add_sigio_fd(fd, 1); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static DEFINE_SPINLOCK(irq_lock); | 113 | static DEFINE_SPINLOCK(irq_lock); |
127 | 114 | ||
128 | int activate_fd(int irq, int fd, int type, void *dev_id) | 115 | int activate_fd(int irq, int fd, int type, void *dev_id) |
@@ -221,7 +208,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id) | |||
221 | /* This calls activate_fd, so it has to be outside the critical | 208 | /* This calls activate_fd, so it has to be outside the critical |
222 | * section. | 209 | * section. |
223 | */ | 210 | */ |
224 | maybe_sigio_broken(fd, type); | 211 | maybe_sigio_broken(fd, (type == IRQ_READ)); |
225 | 212 | ||
226 | return(0); | 213 | return(0); |
227 | 214 | ||
@@ -318,7 +305,7 @@ void reactivate_fd(int fd, int irqnum) | |||
318 | /* This calls activate_fd, so it has to be outside the critical | 305 | /* This calls activate_fd, so it has to be outside the critical |
319 | * section. | 306 | * section. |
320 | */ | 307 | */ |
321 | maybe_sigio_broken(fd, irq->type); | 308 | maybe_sigio_broken(fd, (irq->type == IRQ_READ)); |
322 | } | 309 | } |
323 | 310 | ||
324 | void deactivate_fd(int fd, int irqnum) | 311 | void deactivate_fd(int fd, int irqnum) |
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c index 64c114b02701..7555bf9c33d9 100644 --- a/arch/um/os-Linux/irq.c +++ b/arch/um/os-Linux/irq.c | |||
@@ -52,11 +52,6 @@ int os_waiting_for_events(struct irq_fd *active_fds) | |||
52 | return n; | 52 | return n; |
53 | } | 53 | } |
54 | 54 | ||
55 | int os_isatty(int fd) | ||
56 | { | ||
57 | return isatty(fd); | ||
58 | } | ||
59 | |||
60 | int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) | 55 | int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) |
61 | { | 56 | { |
62 | if (pollfds_num == pollfds_size) { | 57 | if (pollfds_num == pollfds_size) { |
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 00e9388e947a..0d2422a7d72c 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -233,7 +233,7 @@ static struct pollfd *setup_initial_poll(int fd) | |||
233 | return p; | 233 | return p; |
234 | } | 234 | } |
235 | 235 | ||
236 | void write_sigio_workaround(void) | 236 | static void write_sigio_workaround(void) |
237 | { | 237 | { |
238 | unsigned long stack; | 238 | unsigned long stack; |
239 | struct pollfd *p; | 239 | struct pollfd *p; |
@@ -314,6 +314,18 @@ out_close1: | |||
314 | close(l_write_sigio_fds[1]); | 314 | close(l_write_sigio_fds[1]); |
315 | } | 315 | } |
316 | 316 | ||
317 | void maybe_sigio_broken(int fd, int read) | ||
318 | { | ||
319 | if(!isatty(fd)) | ||
320 | return; | ||
321 | |||
322 | if((read || pty_output_sigio) && (!read || pty_close_sigio)) | ||
323 | return; | ||
324 | |||
325 | write_sigio_workaround(); | ||
326 | add_sigio_fd(fd, read); | ||
327 | } | ||
328 | |||
317 | void sigio_cleanup(void) | 329 | void sigio_cleanup(void) |
318 | { | 330 | { |
319 | if(write_sigio_pid != -1){ | 331 | if(write_sigio_pid != -1){ |