socket: Fix get_available_bytes on systems other than Linux and Windows293c103a7de9075b24e2510998a6407cf4f00d5870/head
commit293c103a7de9075b24e2510998a6407cf4f00d58
authorTing-Wei Lan <lantw@src.gnome.org>
Sat, 26 May 2018 03:56:25 +0000 (26 11:56 +0800)
committerTing-Wei Lan <lantw@src.gnome.org>
Sat, 9 Jun 2018 02:02:50 +0000 (9 10:02 +0800)
treef2be2e8261e1bd61fca2e3d0d418b3839168568e
parentb4259dec706b63ff18bedaa6c2943ffbdf679986
socket: Fix get_available_bytes on systems other than Linux and Windows

FIONREAD ioctl on Linux reports the size of payload on UDP sockets.
However, other systems usually add internal header size to the reported
size, which vary between different operating systems and socket types.
To make it work on more systems, we should follow what we do on Windows
instead of using this unreliable FIONREAD ioctl.

This fixes socket test on FreeBSD.
gio/gsocket.c