aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-07-10 07:45:11 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:24 -0400
commit8e64d96aeb495709c13307e2d79f3ee37e96aa4e (patch)
tree41532136fdd081d561343be876d3068464821910 /arch/um
parentbfaafd7184f044c63cd937cb0ffb4334b4ec7635 (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/um')
-rw-r--r--arch/um/include/os.h3
-rw-r--r--arch/um/kernel/irq.c17
-rw-r--r--arch/um/os-Linux/irq.c5
-rw-r--r--arch/um/os-Linux/sigio.c14
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 */
320extern int os_waiting_for_events(struct irq_fd *active_fds); 320extern int os_waiting_for_events(struct irq_fd *active_fds);
321extern int os_isatty(int fd);
322extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds); 321extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds);
323extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, 322extern 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);
330extern void init_irq_signals(int on_sigstack); 329extern void init_irq_signals(int on_sigstack);
331 330
332/* sigio.c */ 331/* sigio.c */
333extern void write_sigio_workaround(void);
334extern int add_sigio_fd(int fd, int read); 332extern int add_sigio_fd(int fd, int read);
335extern int ignore_sigio_fd(int fd); 333extern int ignore_sigio_fd(int fd);
334extern void maybe_sigio_broken(int fd, int read);
336 335
337/* skas/trap */ 336/* skas/trap */
338extern void sig_handler_common_skas(int sig, void *sc_ptr); 337extern 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
113static 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
126static DEFINE_SPINLOCK(irq_lock); 113static DEFINE_SPINLOCK(irq_lock);
127 114
128int activate_fd(int irq, int fd, int type, void *dev_id) 115int 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
324void deactivate_fd(int fd, int irqnum) 311void 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
55int os_isatty(int fd)
56{
57 return isatty(fd);
58}
59
60int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) 55int 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
236void write_sigio_workaround(void) 236static 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
317void 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
317void sigio_cleanup(void) 329void sigio_cleanup(void)
318{ 330{
319 if(write_sigio_pid != -1){ 331 if(write_sigio_pid != -1){