aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/irq.c')
-rw-r--r--arch/um/os-Linux/irq.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
index a26e0662aa1..430866ca1ce 100644
--- a/arch/um/os-Linux/irq.c
+++ b/arch/um/os-Linux/irq.c
@@ -1,22 +1,19 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h> 7#include <errno.h>
8#include <poll.h>
9#include <signal.h> 9#include <signal.h>
10#include <string.h> 10#include <string.h>
11#include <sys/poll.h>
12#include <sys/types.h>
13#include <sys/time.h>
14#include "user.h"
15#include "process.h"
16#include "sigio.h"
17#include "irq_user.h" 11#include "irq_user.h"
12#include "kern_constants.h"
18#include "os.h" 13#include "os.h"
14#include "process.h"
19#include "um_malloc.h" 15#include "um_malloc.h"
16#include "user.h"
20 17
21/* 18/*
22 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd 19 * Locked by irq_lock in arch/um/kernel/irq.c. Changed by os_create_pollfd
@@ -35,7 +32,7 @@ int os_waiting_for_events(struct irq_fd *active_fds)
35 if (n < 0) { 32 if (n < 0) {
36 err = -errno; 33 err = -errno;
37 if (errno != EINTR) 34 if (errno != EINTR)
38 printk("sigio_handler: os_waiting_for_events:" 35 printk(UM_KERN_ERR "os_waiting_for_events:"
39 " poll returned %d, errno = %d\n", n, errno); 36 " poll returned %d, errno = %d\n", n, errno);
40 return err; 37 return err;
41 } 38 }
@@ -94,24 +91,26 @@ void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
94 struct irq_fd *old_fd = *prev; 91 struct irq_fd *old_fd = *prev;
95 if ((pollfds[i].fd != -1) && 92 if ((pollfds[i].fd != -1) &&
96 (pollfds[i].fd != (*prev)->fd)) { 93 (pollfds[i].fd != (*prev)->fd)) {
97 printk("os_free_irq_by_cb - mismatch between " 94 printk(UM_KERN_ERR "os_free_irq_by_cb - "
98 "active_fds and pollfds, fd %d vs %d\n", 95 "mismatch between active_fds and "
96 "pollfds, fd %d vs %d\n",
99 (*prev)->fd, pollfds[i].fd); 97 (*prev)->fd, pollfds[i].fd);
100 goto out; 98 goto out;
101 } 99 }
102 100
103 pollfds_num--; 101 pollfds_num--;
104 102
105 /* This moves the *whole* array after pollfds[i] 103 /*
104 * This moves the *whole* array after pollfds[i]
106 * (though it doesn't spot as such)! 105 * (though it doesn't spot as such)!
107 */ 106 */
108 memmove(&pollfds[i], &pollfds[i + 1], 107 memmove(&pollfds[i], &pollfds[i + 1],
109 (pollfds_num - i) * sizeof(pollfds[0])); 108 (pollfds_num - i) * sizeof(pollfds[0]));
110 if(*last_irq_ptr2 == &old_fd->next) 109 if (*last_irq_ptr2 == &old_fd->next)
111 *last_irq_ptr2 = prev; 110 *last_irq_ptr2 = prev;
112 111
113 *prev = (*prev)->next; 112 *prev = (*prev)->next;
114 if(old_fd->type == IRQ_WRITE) 113 if (old_fd->type == IRQ_WRITE)
115 ignore_sigio_fd(old_fd->fd); 114 ignore_sigio_fd(old_fd->fd);
116 kfree(old_fd); 115 kfree(old_fd);
117 continue; 116 continue;