Make code in src/linux buildable against Darwin headers

This commit is contained in:
Lubos Dolezel 2015-10-13 15:22:20 +02:00
parent 90be779d26
commit 4141957dd9
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/sockios.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
@ -124,7 +124,7 @@ evfilt_read_copyout(struct kevent *dst, struct knote *src, void *ptr)
/* On return, data contains the number of bytes of protocol
data available to read.
*/
if (ioctl(dst->ident, SIOCINQ, &dst->data) < 0) {
if (ioctl(dst->ident, FIONREAD, &dst->data) < 0) {
/* race condition with socket close, so ignore this error */
dbg_puts("ioctl(2) of socket failed");
dst->data = 0;

View File

@ -16,7 +16,7 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/sockios.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
@ -48,7 +48,7 @@ evfilt_socket_copyout(struct kevent *dst, struct knote *src, void *ptr)
dst->fflags = 1; /* FIXME: Return the actual socket error */
/* On return, data contains the the amount of space remaining in the write buffer */
if (ioctl(dst->ident, SIOCOUTQ, &dst->data) < 0) {
if (ioctl(dst->ident, TIOCOUTQ, &dst->data) < 0) {
/* race condition with socket close, so ignore this error */
dbg_puts("ioctl(2) of socket failed");
dst->data = 0;