diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/sigio_kern.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/um/kernel/sigio_kern.c')
-rw-r--r-- | arch/um/kernel/sigio_kern.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c new file mode 100644 index 000000000000..229988463c4c --- /dev/null +++ b/arch/um/kernel/sigio_kern.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "linux/kernel.h" | ||
7 | #include "linux/list.h" | ||
8 | #include "linux/slab.h" | ||
9 | #include "linux/signal.h" | ||
10 | #include "linux/interrupt.h" | ||
11 | #include "init.h" | ||
12 | #include "sigio.h" | ||
13 | #include "irq_user.h" | ||
14 | #include "irq_kern.h" | ||
15 | |||
16 | /* Protected by sigio_lock() called from write_sigio_workaround */ | ||
17 | static int sigio_irq_fd = -1; | ||
18 | |||
19 | static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) | ||
20 | { | ||
21 | read_sigio_fd(sigio_irq_fd); | ||
22 | reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); | ||
23 | return(IRQ_HANDLED); | ||
24 | } | ||
25 | |||
26 | int write_sigio_irq(int fd) | ||
27 | { | ||
28 | int err; | ||
29 | |||
30 | err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, | ||
31 | SA_INTERRUPT | SA_SAMPLE_RANDOM, "write sigio", | ||
32 | NULL); | ||
33 | if(err){ | ||
34 | printk("write_sigio_irq : um_request_irq failed, err = %d\n", | ||
35 | err); | ||
36 | return(-1); | ||
37 | } | ||
38 | sigio_irq_fd = fd; | ||
39 | return(0); | ||
40 | } | ||
41 | |||
42 | static DEFINE_SPINLOCK(sigio_spinlock); | ||
43 | |||
44 | void sigio_lock(void) | ||
45 | { | ||
46 | spin_lock(&sigio_spinlock); | ||
47 | } | ||
48 | |||
49 | void sigio_unlock(void) | ||
50 | { | ||
51 | spin_unlock(&sigio_spinlock); | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
56 | * Emacs will notice this stuff at the end of the file and automatically | ||
57 | * adjust the settings for this buffer only. This must remain at the end | ||
58 | * of the file. | ||
59 | * --------------------------------------------------------------------------- | ||
60 | * Local variables: | ||
61 | * c-file-style: "linux" | ||
62 | * End: | ||
63 | */ | ||