solaris: fix compile error on ctime_r()
authorSaurabh De <SDe@fusionio.com>
Tue, 9 Oct 2012 20:46:24 +0000 (14:46 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 9 Oct 2012 20:46:24 +0000 (14:46 -0600)
On Solaris, it takes a 3rd length argument.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
os/os-solaris.h
os/os.h
stat.c

index d97643d02c71394211e915e429ee91b1d6addf1f..e7a544e1a0bc37c4766a2dc303da9701a1421efa 100644 (file)
@@ -49,6 +49,9 @@ struct solaris_rand_seed {
 #define POSIX_MADV_RANDOM      MADV_RANDOM
 #endif
 
 #define POSIX_MADV_RANDOM      MADV_RANDOM
 #endif
 
+#define os_ctime_r(x, y, z)     ctime_r((x), (y), (z))
+#define FIO_OS_HAS_CTIME_R
+
 typedef psetid_t os_cpu_mask_t;
 typedef struct solaris_rand_seed os_random_state_t;
 
 typedef psetid_t os_cpu_mask_t;
 typedef struct solaris_rand_seed os_random_state_t;
 
diff --git a/os/os.h b/os/os.h
index 8d2a6ae8cd0923a5b29b92bf23ba1052e7065a97..c6da0c3d9f0825efe6f078f59aa6566c6bc27258 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -142,6 +142,10 @@ typedef unsigned long os_cpu_mask_t;
 typedef socklen_t fio_socklen_t;
 #endif
 
 typedef socklen_t fio_socklen_t;
 #endif
 
+#ifndef FIO_OS_HAS_CTIME_R
+#define os_ctime_r(x, y, z)     ctime_r((x), (y))
+#endif
+
 #ifdef FIO_USE_GENERIC_SWAP
 static inline uint16_t fio_swap16(uint16_t val)
 {
 #ifdef FIO_USE_GENERIC_SWAP
 static inline uint16_t fio_swap16(uint16_t val)
 {
diff --git a/stat.c b/stat.c
index 266595262e6fc2ce3595bdeabb12111480036e70..d041ef3c0bb56c770334d551061824113c8b5b2d 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -534,7 +534,7 @@ void show_thread_status(struct thread_stat *ts, struct group_run_stats *rs)
                return;
 
        time(&time_p);
                return;
 
        time(&time_p);
-       ctime_r((const time_t *) &time_p, time_buf);
+       os_ctime_r((const time_t *) &time_p, time_buf, sizeof(time_buf));
 
        if (!ts->error) {
                log_info("%s: (groupid=%d, jobs=%d): err=%2d: pid=%d: %s",
 
        if (!ts->error) {
                log_info("%s: (groupid=%d, jobs=%d): err=%2d: pid=%d: %s",