diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h index 087bd39d06ff1970542e86068aaaa3af7c6990db..0df4076ac47f59a8b7b8ef5e4175fb893b9a4822 100644 --- a/arch/um/include/irq_user.h +++ b/arch/um/include/irq_user.h @@ -14,6 +14,7 @@ extern void free_irq_by_irq_and_dev(int irq, void *dev_id); extern void free_irq_by_fd(int fd); extern void reactivate_fd(int fd, int irqnum); extern void deactivate_fd(int fd, int irqnum); +extern int deactivate_all_fds(void); extern void forward_interrupts(int pid); extern void init_irq_signals(int on_sigstack); extern void forward_ipi(int fd, int pid); diff --git a/arch/um/include/os.h b/arch/um/include/os.h index d676d3dd1395a7b7e436bf556429e48786bf4498..9021fe0f8422482d4a6aba59488e0d5b86b852e5 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h @@ -140,6 +140,7 @@ extern int os_file_size(char *file, long long *size_out); extern int os_file_modtime(char *file, unsigned long *modtime); extern int os_pipe(int *fd, int stream, int close_on_exec); extern int os_set_fd_async(int fd, int owner); +extern int os_clear_fd_async(int fd); extern int os_set_fd_block(int fd, int blocking); extern int os_accept_connection(int fd); extern int os_create_unix_socket(char *file, int len, int close_on_exec); diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h index 9ddb749f7010f07caaf78e646e26943406a4ed87..6793a2fcd0aeed91c48d3182515bd09c2d1e45d6 100644 --- a/arch/um/include/time_user.h +++ b/arch/um/include/time_user.h @@ -11,6 +11,7 @@ extern void switch_timers(int to_real); extern void set_interval(int timer_type); extern void idle_sleep(int secs); extern void enable_timer(void); +extern void disable_timer(void); extern unsigned long time_lock(void); extern void time_unlock(unsigned long); diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c index 87ac2b038a91a414e0be6a64caa19f6288c1b4e4..38e66ac84637ddef1e8176aedd1566ddfc182893 100644 --- a/arch/um/kernel/irq_user.c +++ b/arch/um/kernel/irq_user.c @@ -364,6 +364,20 @@ void deactivate_fd(int fd, int irqnum) irq_unlock(flags); } +int deactivate_all_fds(void) +{ + struct irq_fd *irq; + int err; + + for(irq=active_fds;irq != NULL;irq = irq->next){ + err = os_clear_fd_async(irq->fd); + if(err) + return(err); + } + + return(0); +} + void forward_ipi(int fd, int pid) { int err; diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index cb7ec3736a170994e34ef54eb4bb7ad99cebf71c..efa5b6e73deeb93cefe4b667e85bc2626d9818fd 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c @@ -54,6 +54,15 @@ void enable_timer(void) errno); } +void disable_timer(void) +{ + struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); + if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) || + (setitimer(ITIMER_REAL, &disable, NULL) < 0)) + printk("disnable_timer - setitimer failed, errno = %d\n", + errno); +} + void switch_timers(int to_real) { struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c index 957c380785e1823f271bc71ae91a5c35c458f55e..8d5710cd42ed010a7b9eda2d97076f48607cd872 100644 --- a/arch/um/os-Linux/file.c +++ b/arch/um/os-Linux/file.c @@ -495,6 +495,16 @@ int os_set_fd_async(int fd, int owner) return(0); } +int os_clear_fd_async(int fd) +{ + int flags = fcntl(fd, F_GETFL); + + flags &= ~(O_ASYNC | O_NONBLOCK); + if(fcntl(fd, F_SETFL, flags) < 0) + return(-errno); + return(0); +} + int os_set_fd_block(int fd, int blocking) { int flags;