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 "linux/signal.h"
9 #include "linux/interrupt.h"
13 #include "kern_util.h"
18 struct completion ready
;
24 static irqreturn_t
xterm_interrupt(int irq
, void *data
, struct pt_regs
*regs
)
26 struct xterm_wait
*xterm
= data
;
29 fd
= os_rcv_fd(xterm
->fd
, &xterm
->pid
);
34 complete(&xterm
->ready
);
38 int xterm_fd(int socket
, int *pid_out
)
40 struct xterm_wait
*data
;
43 data
= kmalloc(sizeof(*data
), GFP_KERNEL
);
45 printk(KERN_ERR
"xterm_fd : failed to allocate xterm_wait\n");
49 /* This is a locked semaphore... */
50 *data
= ((struct xterm_wait
)
54 init_completion(&data
->ready
);
56 err
= um_request_irq(XTERM_IRQ
, socket
, IRQ_READ
, xterm_interrupt
,
57 SA_INTERRUPT
| SA_SHIRQ
| SA_SAMPLE_RANDOM
,
60 printk(KERN_ERR
"xterm_fd : failed to get IRQ for xterm, "
66 /* ... so here we wait for an xterm interrupt.
68 * XXX Note, if the xterm doesn't work for some reason (eg. DISPLAY
69 * isn't set) this will hang... */
70 wait_for_completion(&data
->ready
);
72 free_irq(XTERM_IRQ
, data
);
83 * Overrides for Emacs so that we follow Linus's tabbing style.
84 * Emacs will notice this stuff at the end of the file and automatically
85 * adjust the settings for this buffer only. This must remain at the end
87 * ---------------------------------------------------------------------------
89 * c-file-style: "linux"