From 21d9736a2ff5dae65cf0e6bbdc1b1e99c25bc439 Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Sat, 29 May 2010 02:31:09 +0000 Subject: [PATCH] =?UTF-8?q?2010-05-29=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * libfs/src/nfsclient/src/dirutils.c: Add PRIomode_t, PRIdoff_t. * configure.ac: Add AC_CHECK_SIZEOF(mode_t), AC_CHECK_SIZEOF(off_t). --- cpukit/ChangeLog | 5 +++++ cpukit/configure.ac | 6 ++++++ cpukit/libfs/src/nfsclient/src/dirutils.c | 20 +++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index dbc4830f04..e6ef2132d3 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2010-05-29 Ralf Corsépius + + * libfs/src/nfsclient/src/dirutils.c: Add PRIomode_t, PRIdoff_t. + * configure.ac: Add AC_CHECK_SIZEOF(mode_t), AC_CHECK_SIZEOF(off_t). + 2010-05-28 Ralf Corsépius * libfs/src/rfs/rtems-rfs-rtems.c: Use size_t for node_len. diff --git a/cpukit/configure.ac b/cpukit/configure.ac index 6957271dea..ad250b4ec0 100644 --- a/cpukit/configure.ac +++ b/cpukit/configure.ac @@ -248,6 +248,12 @@ AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes]) # configuration-time diagnostics and are not really used. AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include ]) AC_CHECK_DECLS([CHAR_BIT],,,[#include ]) + +# FIXME: We should get rid of this. +# So far, only used in libfs/src/nfsclient/src/dirutils.c +AC_CHECK_SIZEOF([mode_t]) +AC_CHECK_SIZEOF([off_t]) + # FIXME: Mandatory in SUSv4, optional in SUSv3. # Not implemented in GCC/newlib, so far. AC_CHECK_DECLS([WORD_BIT],,,[#include ]) diff --git a/cpukit/libfs/src/nfsclient/src/dirutils.c b/cpukit/libfs/src/nfsclient/src/dirutils.c index bd84e8aa2a..99c65876f3 100644 --- a/cpukit/libfs/src/nfsclient/src/dirutils.c +++ b/cpukit/libfs/src/nfsclient/src/dirutils.c @@ -66,6 +66,24 @@ #include #include /* PATH_MAX */ +#include /* PRI* */ + +#if SIZEOF_MODE_T == 8 +#define PRIomode_t PRIo64 +#elif SIZEOF_MODE_T == 4 +#define PRIomode_t PRIo32 +#else +#error "unsupport size of mode_t" +#endif + +#if SIZEOF_OFF_T == 8 +#define PRIdoff_t PRIo64 +#elif SIZEOF_OFF_T == 4 +#define PRIdoff_t PRIo32 +#else +#error "unsupported size of off_t" +#endif + #ifdef HAVE_CEXP #include #endif @@ -109,7 +127,7 @@ char *t; t = "@"; break; } - printf("%10li, %10lib, %5i.%-5i 0%04o %s%s\n", + printf("%10li, %10" PRIdoff_t "b, %5i.%-5i 0%04" PRIomode_t " %s%s\n", buf->st_ino, buf->st_size, buf->st_uid,