aboutsummaryrefslogtreecommitdiff
path: root/arch/um/kernel/sigio.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-07-10 04:45:13 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 13:24:24 -0700
commit1d3468a6643a6a5905e2ac9ae1fa1aefc06d882a (patch)
tree9f605490ab72b8027e9f5e0d4c9626516d8a73c5 /arch/um/kernel/sigio.c
parent469226a431f553a7b3ec17d87ce3c2d1c6c25fb2 (diff)
[PATCH] uml: move _kern.c files
Move most *_kern.c files in arch/um/kernel to *.c. This makes UML somewhat more closely resemble the other arches. [akpm@osdl.org: use the new INTF_* flags] 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/kernel/sigio.c')
-rw-r--r--arch/um/kernel/sigio.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/um/kernel/sigio.c b/arch/um/kernel/sigio.c
new file mode 100644
index 00000000000..0ad755ceb21
--- /dev/null
+++ b/arch/um/kernel/sigio.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
+ * Licensed under the GPL
+ */
+
+#include "linux/kernel.h"
+#include "linux/list.h"
+#include "linux/slab.h"
+#include "linux/signal.h"
+#include "linux/interrupt.h"
+#include "init.h"
+#include "sigio.h"
+#include "irq_user.h"
+#include "irq_kern.h"
+#include "os.h"
+
+/* Protected by sigio_lock() called from write_sigio_workaround */
+static int sigio_irq_fd = -1;
+
+static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
+{
+ char c;
+
+ os_read_file(sigio_irq_fd, &c, sizeof(c));
+ reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
+ return(IRQ_HANDLED);
+}
+
+int write_sigio_irq(int fd)
+{
+ int err;
+
+ err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
+ IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio",
+ NULL);
+ if(err){
+ printk("write_sigio_irq : um_request_irq failed, err = %d\n",
+ err);
+ return(-1);
+ }
+ sigio_irq_fd = fd;
+ return(0);
+}
+
+static DEFINE_SPINLOCK(sigio_spinlock);
+
+void sigio_lock(void)
+{
+ spin_lock(&sigio_spinlock);
+}
+
+void sigio_unlock(void)
+{
+ spin_unlock(&sigio_spinlock);
+}