From: John Hughes Date: Thu, 8 Mar 2001 16:10:40 +0000 (+0000) Subject: replace some #if FREEBSD by #if HAVE_ST_xxx X-Git-Tag: v4.5.18~1079 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0fc3fd077de3ba606a58d6be8823025482a6762;p=strace replace some #if FREEBSD by #if HAVE_ST_xxx --- diff --git a/ChangeLog b/ChangeLog index a2320b16..dc83121a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-03-08 John Hughes + + * 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 * defs.h: rename wimpy get64 as powerful new LONG_LONG diff --git a/acconfig.h b/acconfig.h index 5c420a10..1c97c3ac 100644 --- a/acconfig.h +++ b/acconfig.h @@ -89,3 +89,18 @@ /* 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 diff --git a/aclocal.m4 b/aclocal.m4 index 6986bd87..27a6cc6e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 ], +[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 ], +[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 ], +[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 ], +[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 ], +[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 +]) + diff --git a/configure.in b/configure.in index 75a8410e..30787900 100644 --- a/configure.in +++ b/configure.in @@ -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 e618b036..a2663d1a 100644 --- 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("...}");