2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include "linux/errno.h"
7 #include "linux/slab.h"
8 #include "asm/semaphore.h"
11 #include "kern_util.h"
22 static void xterm_interrupt(int irq
, void *data
, struct pt_regs
*regs
)
24 struct xterm_wait
*xterm
= data
;
26 xterm
->new_fd
= os_rcv_fd(xterm
->fd
, &xterm
->pid
);
27 if(xterm
->new_fd
== -EAGAIN
)
33 int xterm_fd(int socket
, int *pid_out
)
35 struct xterm_wait
*data
;
38 data
= kmalloc(sizeof(*data
), GFP_KERNEL
);
40 printk(KERN_ERR
"xterm_fd - failed to allocate semaphore\n");
43 *data
= ((struct xterm_wait
)
44 { sem
: __SEMAPHORE_INITIALIZER(data
->sem
, 0),
49 err
= um_request_irq(XTERM_IRQ
, socket
, IRQ_READ
, xterm_interrupt
,
50 SA_INTERRUPT
| SA_SHIRQ
| SA_SAMPLE_RANDOM
,
53 printk(KERN_ERR
"Failed to get IRQ for xterm, err = %d\n",
59 free_irq(XTERM_IRQ
, data
);
69 * Overrides for Emacs so that we follow Linus's tabbing style.
70 * Emacs will notice this stuff at the end of the file and automatically
71 * adjust the settings for this buffer only. This must remain at the end
73 * ---------------------------------------------------------------------------
75 * c-file-style: "linux"