This is the mail archive of the
mailing list for the libstdc++ project.
Re: [RFC] 9533: fourth iteration
- From: Nathan Myers <ncm-nospam at cantrip dot org>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 23 Mar 2003 08:35:21 -0800
- Subject: Re: [RFC] 9533: fourth iteration
- References: <3E7DD4B0.email@example.com>
On Sun, Mar 23, 2003 at 04:37:20PM +0100, Paolo Carlini wrote:
> this is my current best proposal.
> I don't think such kind of syntax:
> AC_DEFINE(_GLIBCPP_S_ISREG_OR_S_IFREG(m), (S_IFREG & (m)))
> can really be used. Therefore I deal separately with the two cases
> (i.e., S_ISREG and S_IFREG).
OK. We can do a _little_ better.
#if defined(_GLIBCPP_HAVE_S_ISREG) || defined(_GLIBCPP_HAVE_S_IFREG)
# ifdef _GLIBCPP_HAVE_S_ISREG
# #define _GLIBCPP_ISREG(x) S_ISREG(x)
# #define _GLIBCPP_ISREG(x) (S_IFREG & (x))
// Regular files.
struct stat __buffer;
int __ret = fstat(this->fd(), &__buffer);
if (!__ret && _GLIBCPP_ISREG(__buffer.st_mode))
return __buffer.st_size - ftell(_M_cfile);
return __buffer.st_size - lseek(this->fd(), 0, ios_base::cur);
> 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.
ncm-nospam at cantrip dot org