Don't include linux/ header in osdSockUnsentCount.

Per the manpage in the file's comment, SIOCOUTQ is equivalent to the
TIOCOUTQ ioctl, whose value can be obtained by including <sys/ioctl.h>,
which allows us to avoid including any system-specific headers. This is
desirable so that, on a musl system, it won't be necessary to install
kernel headers in order to build epics-base.

Since it's first been checked into Git, the Linux kernel has defined
SIOCOUTQ to be TIOCOUTQ [1].

From the three main libc options on Linux: glibc and uclibc use the
kernel headers, so both ioctls are available; and musl defines only
TIOCOUTQ in their own headers.

[1] 1da177e4c3
This commit is contained in:
Érico Nogueira
2023-11-24 08:46:25 -03:00
committed by Andrew Johnson
parent a7c2292d48
commit 21368dc7b4

View File

@@ -4,7 +4,6 @@
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#include <linux/sockios.h>
#define EPICS_PRIVATE_API
#include "osiSock.h"
@@ -14,7 +13,7 @@
*/
int epicsSocketUnsentCount(SOCKET sock) {
int unsent;
if (ioctl(sock, SIOCOUTQ, &unsent) == 0)
if (ioctl(sock, TIOCOUTQ, &unsent) == 0)
return unsent;
return -1;
}