qemu-patch-raspberry4/slirp
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
..
arp_table.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
bootp.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
bootp.h janitor: add guards to headers 2012-12-19 08:31:31 +01:00
cksum.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
COPYRIGHT Remove the advertising clause from the slirp license 2009-01-26 19:37:41 +00:00
debug.h slirp: Cleanup and basic reanimation of debug code 2009-06-29 08:52:46 -05:00
dnssearch.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
if.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
if.h slirp: Clean up ifs_init 2012-02-27 14:54:49 +01:00
ip.h slirp: Avoid statements without effect on Big Endian host 2012-05-28 22:31:07 +02:00
ip_icmp.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
ip_icmp.h slirp: Fix spelling in comment (enought -> enough, insure -> ensure) 2012-10-05 14:24:37 +02:00
ip_input.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
ip_output.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
libslirp.h slirp: set mainloop timeout with more precise value 2013-09-17 12:26:05 +02:00
main.h slirp: switch to GPollFD 2013-02-21 16:17:31 -06:00
Makefile.objs slirp: Add domain-search option to slirp's DHCP server 2012-11-15 10:27:14 +01:00
mbuf.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
mbuf.h slirp: Generalizing and neutralizing ARP code 2016-02-04 13:22:06 +08:00
misc.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
misc.h slirp/misc: Use the GLib memory allocation APIs 2014-08-24 13:16:32 +04:00
sbuf.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
sbuf.h Fix breakage by obsolete _P() for good 2009-07-01 19:11:17 +00:00
slirp.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
slirp.h osdep: add wrappers for socket functions 2016-03-10 17:19:07 +00:00
slirp_config.h slirp/misc: Use the GLib memory allocation APIs 2014-08-24 13:16:32 +04:00
socket.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
socket.h slirp: Add sockaddr_equal, make solookup family-agnostic 2016-02-04 13:22:06 +08:00
tcp.h slirp: Untangle TCPOLEN_* from TCPOPT_* 2012-05-28 13:45:33 +02:00
tcp_input.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
tcp_output.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
tcp_subr.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
tcp_timer.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
tcp_timer.h Fix breakage by obsolete _P() for good 2009-07-01 19:11:17 +00:00
tcp_var.h slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types 2010-07-25 16:59:41 +02:00
tcpip.h Remove the advertising clause from the slirp license 2009-01-26 19:37:41 +00:00
tftp.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
tftp.h Increase maximum number of session of the internal TFTP server. 2014-06-24 20:01:24 +04:00
udp.c slirp: Clean up includes 2016-02-04 17:41:30 +00:00
udp.h slirp: Make udp_attach IPv6 compatible 2016-02-04 14:13:11 +08:00