This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE:[RFC/patch] New iteration at fixing 9533


Hi

This

+#include <poll.h>

and

+    // Cheap test.
+    struct pollfd __pfd[1];
+    __pfd[0].fd = this->fd();
+    __pfd[0].events = POLLIN;
+    if (poll(__pfd, 1, 0) <= 0)
+      return 0;

will break mingw32 (and possibly other targets) which doesn't have poll.h
or poll().

Following doesn't cause problems on mingw32 _unless_ we include winsock.h or
winsock2.h.

+#ifdef FIONREAD
+    // Pipes and sockets.    
+    int __num = 0;
+    int __r = ioctl(this->fd(), FIONREAD, &__num);
+    if (!__r && __num >= 0)
+      return __num; 
+#endif    

mingw does define FIONREAD (in winsock.h) but does not have ioctl.
It does have winsock versions: ioctlsocket (a barebones Berkeley ioctl)
and WSAIoctl which provides functionality similar to ioctl/fcntl.
To be functional these require a call to an initilizer function
WSAStartup, so we can't just #define ioctl ioctlsocket.
I could probably write a _glibcpp_ioctl() wrapper function and add it as a 
an extra module to libgcc2 for mingw target.

Danny

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]