qemu-e2k/include/sysemu
Daniel P. Berrange a2d96af4bb osdep: add wrappers for socket functions
The windows socket functions look identical to the normal POSIX
sockets functions, but instead of setting errno, the caller needs
to call WSAGetLastError(). QEMU has tried to deal with this
incompatibility by defining a socket_error() method that callers
must use that abstracts the difference between WSAGetLastError()
and errno.

This approach is somewhat error prone though - many callers of
the sockets functions are just using errno directly because it
is easy to forget the need use a QEMU specific wrapper. It is
not always immediately obvious that a particular function will
in fact call into Windows sockets functions, so the dev may not
even realize they need to use socket_error().

This introduces an alternative approach to portability inspired
by the way GNULIB fixes portability problems. We use a macro to
redefine the original socket function names to refer to a QEMU
wrapper function. The wrapper function calls the original Win32
sockets method and then sets errno from the WSAGetLastError()
value.

Thus all code can simply call the normal POSIX sockets APIs are
have standard errno reporting on error, even on Windows. This
makes the socket_error() method obsolete.

We also bring closesocket & ioctlsocket into this approach. Even
though they are non-standard Win32 names, we can't wrap the normal
close/ioctl methods since there's no reliable way to distinguish
between a file descriptor and HANDLE in Win32.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-03-10 17:19:07 +00:00
..
accel.h
arch_init.h migration: move ram stuff to migration/ram 2015-06-12 06:40:59 +02:00
balloon.h Inhibit ballooning during postcopy 2015-11-10 15:00:28 +01:00
block-backend.h include: Clean up includes 2016-02-23 12:43:05 +00:00
blockdev.h include: Clean up includes 2016-02-23 12:43:05 +00:00
bt.h
char.h chardev: Properly initialize ChardevCommon components 2016-02-25 16:11:29 +01:00
cpus.h Revert "Introduce cpu_clean_all_dirty" 2015-11-05 11:28:23 +01:00
device_tree.h device_tree: qemu_fdt_getprop_cell converted to use the error API 2016-02-19 09:42:30 -07:00
dma.h include: Clean up includes 2016-02-23 12:43:05 +00:00
dump-arch.h dump: allow target to set the physical base 2016-01-15 14:40:25 +00:00
dump.h DumpState: adding total_size and written_size fields 2016-02-22 18:40:28 +01:00
hostmem.h include: Clean up includes 2016-02-23 12:43:05 +00:00
iothread.h Remove various unused functions 2015-05-08 14:11:10 +03:00
kvm_int.h kvm-all: add support for multiple address spaces 2015-07-06 17:59:43 +02:00
kvm.h include: Clean up includes 2016-02-23 12:43:05 +00:00
memory_mapping.h dump-guest-memory: add "detach" support 2016-02-22 18:40:28 +01:00
numa.h include: Clean up includes 2016-02-23 12:43:05 +00:00
os-posix.h osdep: add wrappers for socket functions 2016-03-10 17:19:07 +00:00
os-win32.h osdep: add wrappers for socket functions 2016-03-10 17:19:07 +00:00
qtest.h include: Clean up includes 2016-02-23 12:43:05 +00:00
replay.h include: Clean up includes 2016-02-23 12:43:05 +00:00
rng-random.h
rng.h rng: switch request queue to QSIMPLEQ 2016-03-08 12:54:14 +05:30
seccomp.h include: Clean up includes 2016-02-23 12:43:05 +00:00
sysemu.h Finish non-postcopiable iterative devices before package 2015-11-12 17:52:29 +01:00
tpm_backend_int.h Remove various unused functions 2015-05-08 14:11:10 +03:00
tpm_backend.h include: Clean up includes 2016-02-23 12:43:05 +00:00
tpm.h TPM: fix build with tpm disabled 2015-06-03 18:19:15 +02:00
watchdog.h watchdog: introduction of get_watchdog_action 2016-01-27 15:34:47 +01:00
xen-mapcache.h include: Clean up includes 2016-02-23 12:43:05 +00:00