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] 9533: fourth iteration


Nathan Myers wrote:

#if defined(_GLIBCPP_HAVE_S_ISREG) || defined(_GLIBCPP_HAVE_S_IFREG)
# ifdef _GLIBCPP_HAVE_S_ISREG
#   #define _GLIBCPP_ISREG(x) S_ISREG(x)
# else
#   #define _GLIBCPP_ISREG(x) (S_IFREG & (x))
# endif
   // Regular files.
   struct stat __buffer;
   int __ret = fstat(this->fd(), &__buffer);
   if (!__ret && _GLIBCPP_ISREG(__buffer.st_mode))
     if (__stdio)
	return __buffer.st_size - ftell(_M_cfile);
     else
	return __buffer.st_size - lseek(this->fd(), 0, ios_base::cur);
#endif
   return 0;
 }

Great! Indeed, this is better, will produce another iteration.

About ioctl, I haven't been able to find an example of a modern
system having it in <ioctl.h>, not in <sys/ioctl.h> or <sys/filio.h>,
therefore I'm relying on the code which I stolen from libjava:
seems to work well there for a variety of different platforms.


It works on all the platforms I care about anyway.

Good (*).

Paolo.

(*) I have just ordered my own copies of Stevens, anyway.


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