x86: add PAGE_KERNEL_EXEC_NOCACHE
[wrt350n-kernel.git] / arch / um / kernel / sigio.c
blob89f9866a1354b8073cf5f015bd4b80e276b6e9a4
1 /*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
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 #include "os.h"
17 /* Protected by sigio_lock() called from write_sigio_workaround */
18 static int sigio_irq_fd = -1;
20 static irqreturn_t sigio_interrupt(int irq, void *data)
22 char c;
24 os_read_file(sigio_irq_fd, &c, sizeof(c));
25 reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
26 return IRQ_HANDLED;
29 int write_sigio_irq(int fd)
31 int err;
33 err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
34 IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio",
35 NULL);
36 if(err){
37 printk("write_sigio_irq : um_request_irq failed, err = %d\n",
38 err);
39 return -1;
41 sigio_irq_fd = fd;
42 return 0;
45 /* These are called from os-Linux/sigio.c to protect its pollfds arrays. */
46 static DEFINE_SPINLOCK(sigio_spinlock);
48 void sigio_lock(void)
50 spin_lock(&sigio_spinlock);
53 void sigio_unlock(void)
55 spin_unlock(&sigio_spinlock);