Browse Source

tcp: fix compilation problem on solaris (FIONREAD)

- on solaris include <sys/filio.h> if present, else define BSD_COMP before
 including ioctl.h.

Reported-by: Vance Shipley vances at motivity ca.
Andrei Pelinescu-Onciul 16 years ago
parent
commit
0d2d401891
2 changed files with 15 additions and 0 deletions
  1. 10 0
      Makefile.defs
  2. 5 0
      tcp_main.c

+ 10 - 0
Makefile.defs

@@ -1440,6 +1440,16 @@ ifeq  ($(OS), solaris)
 	ifeq ($(NO_SELECT),)
 		DEFS+=-DHAVE_SELECT
 	endif
+	# check for filio.h
+	filio_h_locations= /usr/include/sys/filio.h \
+						$(LOCALBASE)/include/sys/filio.h
+	has_filio_h=$(shell for r in $(filio_h_locations); do \
+						if  [ -r "$$r" ] ; then echo yes; exit; fi \
+						done;\
+				)
+	ifeq ($(has_filio_h), yes)
+		DEFS+=-DHAVE_FILIO_H
+	endif
 	ifeq ($(mode), release)
 		#use these only if you're using gcc with Solaris ld
 		#LDFLAGS=-O2 $(PROFILE)

+ 5 - 0
tcp_main.c

@@ -115,6 +115,11 @@
 #include <sys/types.h>
 #include <sys/select.h>
 #include <sys/socket.h>
+#ifdef HAVE_FILIO_H
+#include <sys/filio.h> /* needed on solaris 2.x for FIONREAD */
+#elif defined __OS_solaris
+#define BSD_COMP  /* needed on older solaris for FIONREAD */
+#endif /* HAVE_FILIO_H / __OS_solaris */
 #include <sys/ioctl.h>  /* ioctl() used on write error */
 #include <netinet/in.h>
 #include <netinet/in_systm.h>