Use TIOCOUTQ instead of SIOCOUTQ to avoid need for linux/sockios.h

All that the kernel header was doing here is defining SIOCOUTQ to be
TIOCOUTQ. Instead of pulling in the header, we might as well use
TIOCOUTQ directly.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-03-26 11:40:35 +02:00
parent 6d07e76020
commit 31afdd2274

View file

@ -15,7 +15,6 @@
#include <fcntl.h> #include <fcntl.h>
#ifdef __linux__ #ifdef __linux__
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/sockios.h>
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef ANDROID #ifdef ANDROID
#include <cutils/sockets.h> #include <cutils/sockets.h>
@ -90,7 +89,7 @@ static void wpas_ctrl_sock_debug(const char *title, int sock, const char *buf,
if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0) if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0)
sndbuf = -1; sndbuf = -1;
if (ioctl(sock, SIOCOUTQ, &outq) < 0) if (ioctl(sock, TIOCOUTQ, &outq) < 0)
outq = -1; outq = -1;
wpa_printf(level, wpa_printf(level,
@ -289,7 +288,7 @@ static int wpas_ctrl_iface_throttle(int sock)
optlen = sizeof(sndbuf); optlen = sizeof(sndbuf);
sndbuf = 0; sndbuf = 0;
if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0 || if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0 ||
ioctl(sock, SIOCOUTQ, &outq) < 0 || ioctl(sock, TIOCOUTQ, &outq) < 0 ||
sndbuf <= 0 || outq < 0) sndbuf <= 0 || outq < 0)
return 0; return 0;
return outq > sndbuf / 2; return outq > sndbuf / 2;