From e64bd134085451fe3f751025c5d5a70729164b7c Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 10 Jul 2006 04:45:07 -0700 Subject: [PATCH] uml: signal initialization cleanup It turns out that init_new_thread_signals is always called with altstack == 1, so we can eliminate the parameter. Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/os.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/um/include/os.h') diff --git a/arch/um/include/os.h b/arch/um/include/os.h index f88856c28a66..700f7a76c822 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -199,7 +199,7 @@ extern int os_getpid(void); extern int os_getpgrp(void); extern void init_new_thread_stack(void *sig_stack, void (*usr1_handler)(int)); -extern void init_new_thread_signals(int altstack); +extern void init_new_thread_signals(void); extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); extern int os_map_memory(void *virt, int fd, unsigned long long off, -- cgit v1.2.3 From 8e64d96aeb495709c13307e2d79f3ee37e96aa4e Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 10 Jul 2006 04:45:11 -0700 Subject: [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 Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/os.h | 3 +-- arch/um/kernel/irq.c | 17 ++--------------- arch/um/os-Linux/irq.c | 5 ----- arch/um/os-Linux/sigio.c | 14 +++++++++++++- 4 files changed, 16 insertions(+), 23 deletions(-) (limited to 'arch/um/include/os.h') 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); /* irq.c */ extern int os_waiting_for_events(struct irq_fd *active_fds); -extern int os_isatty(int fd); extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds); extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg, struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2); @@ -330,9 +329,9 @@ extern void os_set_ioignore(void); extern void init_irq_signals(int on_sigstack); /* sigio.c */ -extern void write_sigio_workaround(void); extern int add_sigio_fd(int fd, int read); extern int ignore_sigio_fd(int fd); +extern void maybe_sigio_broken(int fd, int read); /* skas/trap */ 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) free_irqs(); } -static void maybe_sigio_broken(int fd, int type) -{ - if (os_isatty(fd)) { - if ((type == IRQ_WRITE) && !pty_output_sigio) { - write_sigio_workaround(); - add_sigio_fd(fd, 0); - } else if ((type == IRQ_READ) && !pty_close_sigio) { - write_sigio_workaround(); - add_sigio_fd(fd, 1); - } - } -} - static DEFINE_SPINLOCK(irq_lock); 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) /* This calls activate_fd, so it has to be outside the critical * section. */ - maybe_sigio_broken(fd, type); + maybe_sigio_broken(fd, (type == IRQ_READ)); return(0); @@ -318,7 +305,7 @@ void reactivate_fd(int fd, int irqnum) /* This calls activate_fd, so it has to be outside the critical * section. */ - maybe_sigio_broken(fd, irq->type); + maybe_sigio_broken(fd, (irq->type == IRQ_READ)); } 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) return n; } -int os_isatty(int fd) -{ - return isatty(fd); -} - int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds) { 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) return p; } -void write_sigio_workaround(void) +static void write_sigio_workaround(void) { unsigned long stack; struct pollfd *p; @@ -314,6 +314,18 @@ out_close1: 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); +} + void sigio_cleanup(void) { if(write_sigio_pid != -1){ -- cgit v1.2.3 From 29ac1c2142346e1e0e072f41df31688fc42ff540 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Mon, 10 Jul 2006 04:45:12 -0700 Subject: [PATCH] uml: make some symbols static A few sigio-related things can be made static. Signed-off-by: Jeff Dike Cc: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/os.h | 1 - arch/um/kernel/sigio_kern.c | 14 -------------- arch/um/os-Linux/sigio.c | 10 ++++++---- 3 files changed, 6 insertions(+), 19 deletions(-) (limited to 'arch/um/include/os.h') diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 548f6ddd8597..b6c52496e15a 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -329,7 +329,6 @@ extern void os_set_ioignore(void); extern void init_irq_signals(int on_sigstack); /* sigio.c */ -extern int add_sigio_fd(int fd, int read); extern int ignore_sigio_fd(int fd); extern void maybe_sigio_broken(int fd, int read); diff --git a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c index 51b677083948..5102ba5d5bd0 100644 --- a/arch/um/kernel/sigio_kern.c +++ b/arch/um/kernel/sigio_kern.c @@ -53,17 +53,3 @@ void sigio_unlock(void) { spin_unlock(&sigio_spinlock); } - -extern void sigio_cleanup(void); -__uml_exitcall(sigio_cleanup); - -/* - * Overrides for Emacs so that we follow Linus's tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local variables: - * c-file-style: "linux" - * End: - */ diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index d22623e8fced..0ecac563c7b3 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c @@ -43,13 +43,13 @@ struct pollfds { /* Protected by sigio_lock(). Used by the sigio thread, but the UML thread * synchronizes with it. */ -struct pollfds current_poll = { +static struct pollfds current_poll = { .poll = NULL, .size = 0, .used = 0 }; -struct pollfds next_poll = { +static struct pollfds next_poll = { .poll = NULL, .size = 0, .used = 0 @@ -156,7 +156,7 @@ static void update_thread(void) set_signals(flags); } -int add_sigio_fd(int fd, int read) +static int add_sigio_fd(int fd, int read) { int err = 0, i, n, events; @@ -333,10 +333,12 @@ void maybe_sigio_broken(int fd, int read) add_sigio_fd(fd, read); } -void sigio_cleanup(void) +static void sigio_cleanup(void) { if(write_sigio_pid != -1){ os_kill_process(write_sigio_pid, 1); write_sigio_pid = -1; } } + +__uml_exitcall(sigio_cleanup); -- cgit v1.2.3 From 329c6e4257d6a89990d72617d91437e2ce59e426 Mon Sep 17 00:00:00 2001 From: Jeff Dike Date: Fri, 14 Jul 2006 00:24:03 -0700 Subject: [PATCH] uml: header formatting cleanups Clean up whitespace and return syntax in os.h. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/um/include/os.h | 68 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'arch/um/include/os.h') diff --git a/arch/um/include/os.h b/arch/um/include/os.h index b6c52496e15a..5316e8a4a4fd 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) * Licensed under the GPL */ @@ -15,9 +15,9 @@ #include "irq_user.h" #include "sysdep/tls.h" -#define OS_TYPE_FILE 1 -#define OS_TYPE_DIR 2 -#define OS_TYPE_SYMLINK 3 +#define OS_TYPE_FILE 1 +#define OS_TYPE_DIR 2 +#define OS_TYPE_SYMLINK 3 #define OS_TYPE_CHARDEV 4 #define OS_TYPE_BLOCKDEV 5 #define OS_TYPE_FIFO 6 @@ -61,68 +61,68 @@ struct openflags { }; #define OPENFLAGS() ((struct openflags) { .r = 0, .w = 0, .s = 0, .c = 0, \ - .t = 0, .a = 0, .e = 0, .cl = 0 }) + .t = 0, .a = 0, .e = 0, .cl = 0 }) static inline struct openflags of_read(struct openflags flags) { - flags.r = 1; - return(flags); + flags.r = 1; + return flags; } static inline struct openflags of_write(struct openflags flags) { - flags.w = 1; - return(flags); + flags.w = 1; + return flags; } static inline struct openflags of_rdwr(struct openflags flags) { - return(of_read(of_write(flags))); + return of_read(of_write(flags)); } static inline struct openflags of_set_rw(struct openflags flags, int r, int w) { flags.r = r; flags.w = w; - return(flags); + return flags; } static inline struct openflags of_sync(struct openflags flags) -{ - flags.s = 1; - return(flags); +{ + flags.s = 1; + return flags; } static inline struct openflags of_create(struct openflags flags) -{ - flags.c = 1; - return(flags); +{ + flags.c = 1; + return flags; } - + static inline struct openflags of_trunc(struct openflags flags) -{ - flags.t = 1; - return(flags); +{ + flags.t = 1; + return flags; } - + static inline struct openflags of_append(struct openflags flags) -{ - flags.a = 1; - return(flags); +{ + flags.a = 1; + return flags; } - + static inline struct openflags of_excl(struct openflags flags) -{ - flags.e = 1; - return(flags); +{ + flags.e = 1; + return flags; } static inline struct openflags of_cloexec(struct openflags flags) -{ - flags.cl = 1; - return(flags); +{ + flags.cl = 1; + return flags; } - + /* file.c */ extern int os_stat_file(const char *file_name, struct uml_stat *buf); extern int os_stat_fd(const int fd, struct uml_stat *buf); @@ -204,7 +204,7 @@ extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); extern int os_map_memory(void *virt, int fd, unsigned long long off, unsigned long len, int r, int w, int x); -extern int os_protect_memory(void *addr, unsigned long len, +extern int os_protect_memory(void *addr, unsigned long len, int r, int w, int x); extern int os_unmap_memory(void *addr, int len); extern int os_drop_memory(void *addr, int length); -- cgit v1.2.3