ia64/xen-unstable

view tools/ioemu/osdep.h @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 8e5fc5fe636c
children f7b43e5c42b9
line source
1 #ifndef QEMU_OSDEP_H
2 #define QEMU_OSDEP_H
4 #include <stdarg.h>
6 int qemu_vsnprintf(char *buf, int buflen, const char *fmt, va_list args);
7 void qemu_vprintf(const char *fmt, va_list ap);
8 void qemu_printf(const char *fmt, ...);
10 void *qemu_malloc(size_t size);
11 void *qemu_mallocz(size_t size);
12 void qemu_free(void *ptr);
13 char *qemu_strdup(const char *str);
15 void *get_mmap_addr(unsigned long size);
17 /* specific kludges for OS compatibility (should be moved elsewhere) */
18 #if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
20 /* disabled pthread version of longjmp which prevent us from using an
21 alternative signal stack */
22 extern void __longjmp(jmp_buf env, int val);
23 #define longjmp __longjmp
25 #include <signal.h>
27 /* NOTE: it works only because the glibc sigset_t is >= kernel sigset_t */
28 struct qemu_sigaction {
29 union {
30 void (*_sa_handler)(int);
31 void (*_sa_sigaction)(int, struct siginfo *, void *);
32 } _u;
33 unsigned long sa_flags;
34 void (*sa_restorer)(void);
35 sigset_t sa_mask; /* mask last for extensibility */
36 };
38 int qemu_sigaction(int signum, const struct qemu_sigaction *act,
39 struct qemu_sigaction *oldact);
41 #undef sigaction
42 #undef sa_handler
43 #undef sa_sigaction
44 #define sigaction qemu_sigaction
45 #define sa_handler _u._sa_handler
46 #define sa_sigaction _u._sa_sigaction
48 #endif
50 #endif