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


Nathan Myers wrote:

"S_ISREG(m)" is the preferred interface.  When S_ISREG isn't defined,
you have to use "(S_IFREG & (m))" instead.  An expression "S_IFREG(m)"
would expand to "0100000(m)", a syntax error.  Of course you haven't
seen this, because where you test, you have had S_ISREG() defined.

Ah, ok, but you didn't tell me about this before!
If AC_DEFINE actually supports the syntax you suggested

AC_DEFINE(_GLIBCPP_S_ISREG_OR_S_IFREG(m), (S_IFREG & (m)))

it's easy, but I'm not sure. Are you?

BTW, Stevens seems to suggest that some targets have <ioctl.h> but
not <sys/ioctl.h>.  Sorry to be a pest.

Well, you are welcome, but then please be a pest also with the libjava people not only with me! ;)
See, e.g., libjava/java/net/natPlainSocketImplPosix.cc.


 The problem is that this
sort of thing would not show up in testing; instead, ./configure
would just not find FIONREAD, then.

What has configure to do with FIONREAD???
Configure looks for sys/ioctl.h and sys/filio.h. Then this code:

#ifdef _GLIBCPP_HAVE_SYS_IOCTL_H
#define BSD_COMP /* Get FIONREAD on Solaris2. */
#include <sys/ioctl.h>
#endif

// Pick up FIONREAD on Solaris 2.5.
#ifdef _GLIBCPP_HAVE_SYS_FILIO_H
#include <sys/filio.h>
#endif

includes the correct header. Below:

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


if FIONREAD is not defined, there is no ioctl call at all!

Paolo.


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