]> granicus.if.org Git - strace/commitdiff
replace some #if FREEBSD by #if HAVE_ST_xxx
authorJohn Hughes <john@Calva.COM>
Thu, 8 Mar 2001 16:10:40 +0000 (16:10 +0000)
committerJohn Hughes <john@Calva.COM>
Thu, 8 Mar 2001 16:10:40 +0000 (16:10 +0000)
ChangeLog
acconfig.h
aclocal.m4
configure.in
file.c

index a2320b16a9e6351f8f6be8d6fce4bedfd53f57d0..dc83121ac2b5b8b9e4e7521980ec4592a51aa102 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-03-08  John Hughes <john@Calva.COM>
+
+  * acconfig.h: add new ST_xxx defines.
+  * aclocal.m4: macros to check for more fields in struct stat.
+  * configure.in: use new macros to check for fields in struct stat.
+  * file.c: use new defines to replace #ifdef FREEBSD by #if HAVE_ST_xxx.
+
 2001-03-08  John Hughes <john@Calva.COM>
 
   * defs.h: rename wimpy get64 as powerful new LONG_LONG
index 5c420a10477a1a51328eba85098e67a99a550e39..1c97c3ac0e8fbd5cd18dbdf38c3228e20c03171c 100644 (file)
 
 /* Define if linux struct sockaddr_in6 contains sin6_scope_id fiels. */
 #undef HAVE_SIN6_SCOPE_ID_LINUX
+
+/* Define if have st_flags in struct stat */
+#undef HAVE_ST_FLAGS
+
+/* Define if have st_aclcnt in struct stat */
+#undef HAVE_ST_ACLCNT
+
+/* Define if have st_level in struct stat */
+#undef HAVE_ST_LEVEL
+
+/* Define if have st_fstype in struct stat */
+#undef HAVE_ST_FSTYPE
+
+/* Define if have st_gen in struct stat */
+#undef HAVE_ST_GEN
index 6986bd87ba4667a40845d0cf5996da4292cc00b0..27a6cc6eb94cf7116f50b71e3572c0a0100944ca 100644 (file)
@@ -401,3 +401,83 @@ else
 fi
 ])
 
+dnl ### A macro to check for st_flags in struct stat
+AC_DEFUN(AC_ST_FLAGS,
+[AC_MSG_CHECKING(for st_flags in struct stat)
+AC_CACHE_VAL(ac_cv_have_st_flags,
+[AC_TRY_COMPILE([#include <sys/stat.h>],
+[struct stat buf;
+buf.st_flags = 0;],
+ac_cv_have_st_flags=yes,
+ac_cv_have_st_flags=no)])
+AC_MSG_RESULT($ac_cv_have_st_flags)
+if test "$ac_cv_have_st_flags" = yes
+then
+       AC_DEFINE(HAVE_ST_FLAGS)
+fi
+])
+
+dnl ### A macro to check for st_aclcnt in struct stat
+AC_DEFUN(AC_ST_ACLCNT,
+[AC_MSG_CHECKING(for st_aclcnt in struct stat)
+AC_CACHE_VAL(ac_cv_have_st_aclcnt,
+[AC_TRY_COMPILE([#include <sys/stat.h>],
+[struct stat buf;
+buf.st_aclcnt = 0;],
+ac_cv_have_st_aclcnt=yes,
+ac_cv_have_st_aclcnt=no)])
+AC_MSG_RESULT($ac_cv_have_st_aclcnt)
+if test "$ac_cv_have_st_aclcnt" = yes
+then
+       AC_DEFINE(HAVE_ST_ACLCNT)
+fi
+])
+
+dnl ### A macro to check for st_level in struct stat
+AC_DEFUN(AC_ST_LEVEL,
+[AC_MSG_CHECKING(for st_level in struct stat)
+AC_CACHE_VAL(ac_cv_have_st_level,
+[AC_TRY_COMPILE([#include <sys/stat.h>],
+[struct stat buf;
+buf.st_level = 0;],
+ac_cv_have_st_level=yes,
+ac_cv_have_st_level=no)])
+AC_MSG_RESULT($ac_cv_have_st_level)
+if test "$ac_cv_have_st_level" = yes
+then
+       AC_DEFINE(HAVE_ST_LEVEL)
+fi
+])
+
+dnl ### A macro to check for st_fstype in struct stat
+AC_DEFUN(AC_ST_FSTYPE,
+[AC_MSG_CHECKING(for st_fstype in struct stat)
+AC_CACHE_VAL(ac_cv_have_st_fstype,
+[AC_TRY_COMPILE([#include <sys/stat.h>],
+[struct stat buf;
+buf.st_fstype[0] = 0;],
+ac_cv_have_st_fstype=yes,
+ac_cv_have_st_fstype=no)])
+AC_MSG_RESULT($ac_cv_have_st_fstype)
+if test "$ac_cv_have_st_fstype" = yes
+then
+       AC_DEFINE(HAVE_ST_FSTYPE)
+fi
+])
+
+dnl ### A macro to check for st_gen in struct stat
+AC_DEFUN(AC_ST_GEN,
+[AC_MSG_CHECKING(for st_gen in struct stat)
+AC_CACHE_VAL(ac_cv_have_st_gen,
+[AC_TRY_COMPILE([#include <sys/stat.h>],
+[struct stat buf;
+buf.st_gen = 0;],
+ac_cv_have_st_gen=yes,
+ac_cv_have_st_gen=no)])
+AC_MSG_RESULT($ac_cv_have_st_gen)
+if test "$ac_cv_have_st_gen" = yes
+then
+       AC_DEFINE(HAVE_ST_GEN)
+fi
+])
+
index 75a8410e30c201ae72417270d69c637df58371cb..307879005b4763e589d70d90f16dba0f3539b655 100644 (file)
@@ -150,6 +150,11 @@ AC_SIN6_SCOPE_ID
 AC_LONG_LONG
 AC_OFF_T_IS_LONG_LONG
 AC_RLIM_T_IS_LONG_LONG
+AC_ST_FLAGS
+AC_ST_ACLCNT
+AC_ST_LEVEL
+AC_ST_FSTYPE
+AC_ST_GEN
 if test x$OPSYS != xLINUX; then
 AC_CHECK_LIB(nsl, main)
 fi
diff --git a/file.c b/file.c
index e618b0360cf8061beb5740d29127a0204df6a078..a2663d1a5f6076d9489a62532d20c1e067839e34 100644 (file)
--- a/file.c
+++ b/file.c
@@ -624,8 +624,8 @@ long addr;
 }
 #endif /* LINUXSPARC */
 
-#ifdef FREEBSD
 static struct xlat fileflags[] = {
+#ifdef FREEBSD
        { UF_NODUMP,    "UF_NODUMP"     },
        { UF_IMMUTABLE, "UF_IMMUTABLE"  },
        { UF_APPEND,    "UF_APPEND"     },
@@ -635,9 +635,18 @@ static struct xlat fileflags[] = {
        { SF_IMMUTABLE, "SF_IMMUTABLE"  },
        { SF_APPEND,    "SF_APPEND"     },
        { SF_NOUNLINK,  "SF_NOUNLINK"   },
+#elif UNIXWARE >= 2
+#ifdef         _S_ISMLD
+       { _S_ISMLD,     "_S_ISMLD"      },
+#endif
+#ifdef         _S_ISMOUNTED
+       { _S_ISMOUNTED, "_S_ISMOUNTED"  },
+#endif
+#endif
        { 0,            NULL            },
 };
 
+#ifdef FREEBSD
 int
 sys_chflags(tcp)
 struct tcb *tcp;
@@ -712,7 +721,28 @@ struct stat *statbuf;
     if (!abbrev(tcp)) {
            tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
            tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
-           tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
+           tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
+#if HAVE_ST_FLAGS
+               tprintf(", st_flags=");
+               if (statbuf->st_flags) {
+                       printflags(fileflags, statbuf->st_flags);
+               } else
+                       tprintf("0");
+#endif
+#if HAVE_ST_ACLCNT
+               tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
+#endif
+#if HAVE_ST_LEVEL
+               tprintf(", st_level=%ld", statbuf->st_level);
+#endif
+#if HAVE_ST_FSTYPE
+               tprintf(", st_fstype=%.*s",
+                       (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
+#endif
+#if HAVE_ST_GEN
+               tprintf(", st_gen=%u", statbuf->st_gen);
+#endif
+               tprintf("}");
     }
     else
            tprintf("...}");
@@ -825,17 +855,28 @@ long addr;
        if (!abbrev(tcp)) {
                tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
                tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
-#ifndef FREEBSD
-               tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
-#else /* FREEBSD */
-               tprintf("st_ctime=%s, ", sprinttime(statbuf.st_ctime));
-               tprintf("st_flags=");
+               tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
+#if HAVE_ST_FLAGS
+               tprintf(", st_flags=");
                if (statbuf.st_flags) {
                        printflags(fileflags, statbuf.st_flags);
                } else
                        tprintf("0");
-               tprintf(", st_gen=%u}", statbuf.st_gen);
-#endif /* FREEBSD */
+#endif
+#if HAVE_ST_ACLCNT
+               tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
+#endif
+#if HAVE_ST_LEVEL
+               tprintf(", st_level=%ld", statbuf.st_level);
+#endif
+#if HAVE_ST_FSTYPE
+               tprintf(", st_fstype=%.*s",
+                       (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
+#endif
+#if HAVE_ST_GEN
+               tprintf(", st_gen=%u", statbuf.st_gen);
+#endif
+               tprintf("}");
        }
        else
                tprintf("...}");