This is the mail archive of the mailing list for the glibc project.

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

Re: intl patches (18)

> From: Bruno Haible <>
> Date: Mon, 19 Mar 2001 22:41:46 +0100 (CET)
> stat64 is not portable. Outside glibc normal 'stat' is the best
> thing use for libintl. (The message catalogs never will be 2 GB
> large. Also, I cannot simply '#define stat64 stat' to work around
> the problem, because <sys/stat.h> does '#define stat stat64' when
> __USE_FILE_OFFSET64 is defined and __REDIRECT is not.)

Another reason not to '#define stat64 stat' is that Solaris does that
#define in some cases and you don't want to collide with that.

I ran into a similar problem a couple of months ago with tempname.c,
and worked around it with code that looked like the following, which
is currently installed.  So far it seems to be working.  One advantage
of this approach is that it uses _STAT_VER when in glibc.

   #if _LIBC
   # define struct_stat64 struct stat64
   # define struct_stat64 struct stat
   # define __lxstat64(version, path, buf) lstat (path, buf)
   # define __xstat64(version, path, buf) stat (path, buf)
   # define __fxstat64(version, fd, buf) fstat (fd, buf)


   /* Return nonzero if DIR is an existent directory.  */
   static int
   direxists (const char *dir)
     struct_stat64 buf;
     return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode);

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