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] |
+#include <poll.h>Ok, will add an autoconf test for it in the next iteration.
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().
Therefore, it would be ok with you if I keep the ioctl() code which then will be actually enabled on mingwFollowing 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.
Thanks, Paolo.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |