bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils stat port to Solaris 9


From: Paul Eggert
Subject: coreutils stat port to Solaris 9
Date: Tue, 16 Nov 2004 19:14:48 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Building coreutils CVS on Solaris 9 had this problem:

cc -xarch=v9 -DHAVE_CONFIG_H -I. -I. -I..  -I.. -I. -I../lib -I../lib    -g -c 
stat.c
"stat.c", line 563: warning: implicit function declaration: statfs

It turns out that the code was incorrect: it was calling statfs, but
on Solaris 9 you're supposed to call statvfs instead.  (lib/fsusage.c
gets it right.)  I installed this patch.

2004-11-16  Paul Eggert  <address@hidden>

        * src/stat.c (STATFS): New macro, for portability to Solaris 9.
        (do_statfs): Use it.

Index: stat.c
===================================================================
RCS file: /fetish/cu/src/stat.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -p -u -r1.75 -r1.76
--- stat.c      3 Sep 2004 21:58:36 -0000       1.75
+++ stat.c      17 Nov 2004 03:12:06 -0000      1.76
@@ -63,6 +63,9 @@
 # if HAVE_STRUCT_STATVFS_F_NAMEMAX
 #  define SB_F_NAMEMAX(S) ((uintmax_t) ((S)->f_namemax))
 # endif
+# if STAT_STATVFS
+#  define STATFS statvfs
+# endif
 #else
 # define STRUCT_STATVFS struct statfs
 # define HAVE_STRUCT_STATXFS_F_TYPE HAVE_STRUCT_STATFS_F_TYPE
@@ -71,6 +74,10 @@
 # endif
 #endif
 
+#ifndef STATFS
+# define STATFS statfs
+#endif
+
 #ifndef SB_F_NAMEMAX
 /* NetBSD 1.5.2 has neither f_namemax nor f_namelen.  */
 # define SB_F_NAMEMAX(S) "*"
@@ -560,7 +567,7 @@ do_statfs (char const *filename, bool te
 {
   STRUCT_STATVFS statfsbuf;
 
-  if (statfs (filename, &statfsbuf) != 0)
+  if (STATFS (filename, &statfsbuf) != 0)
     {
       error (0, errno, _("cannot read file system information for %s"),
             quote (filename));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]