From 5f11ba4e59c39648694d62d55da0ee00c598342e Mon Sep 17 00:00:00 2001 From: Corrado Primier Date: Tue, 5 Oct 2021 18:49:05 +0000 Subject: [PATCH] Add support for Solaris-based OSs --- README.rst | 2 +- lib/formats/progressbar.c | 4 ++++ lib/formats/stats.c | 4 ++++ lib/formats/summary.c | 4 ++++ lib/utilities.h | 2 ++ src/rmlint.c | 4 ++++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ba673d71b..e37643b7a 100644 --- a/README.rst +++ b/README.rst @@ -48,7 +48,7 @@ Finds… - ``btrfs`` support. - ... -It runs and compiles under most Unices, including Linux, FreeBSD and Darwin. +It runs and compiles under most Unices, including Linux, FreeBSD, Darwin and Solaris. The main target is Linux though, some optimisations might not be available elsewhere. diff --git a/lib/formats/progressbar.c b/lib/formats/progressbar.c index c61714dcc..74bde6f9a 100644 --- a/lib/formats/progressbar.c +++ b/lib/formats/progressbar.c @@ -33,6 +33,10 @@ #include +#if defined(__sun) +#include +#endif + typedef struct RmFmtHandlerProgress { /* must be first */ RmFmtHandler parent; diff --git a/lib/formats/stats.c b/lib/formats/stats.c index 246ab2131..22b940276 100644 --- a/lib/formats/stats.c +++ b/lib/formats/stats.c @@ -32,6 +32,10 @@ #include +#if defined(__sun) +#include +#endif + #define ARROW \ fprintf(out, "%s==>%s ", MAYBE_YELLOW(out, session), MAYBE_RESET(out, session)); diff --git a/lib/formats/summary.c b/lib/formats/summary.c index 5424e6ca3..8908c85be 100644 --- a/lib/formats/summary.c +++ b/lib/formats/summary.c @@ -32,6 +32,10 @@ #include +#if defined(__sun) +#include +#endif + typedef struct RmFmtHandlerSummary { /* must be first */ RmFmtHandler parent; diff --git a/lib/utilities.h b/lib/utilities.h index 135be2ac9..7ceacf6e6 100644 --- a/lib/utilities.h +++ b/lib/utilities.h @@ -106,6 +106,8 @@ WARN_UNUSED_RESULT static inline int rm_sys_lstat(const char *path, RmStat *buf) static inline gdouble rm_sys_stat_mtime_float(RmStat *stat) { #if RM_IS_APPLE return (gdouble)stat->st_mtimespec.tv_sec + stat->st_mtimespec.tv_nsec / 1000000000.0; +#elif defined(__sun) && !(!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) + return (gdouble)stat->st_mtim.__tv_sec + stat->st_mtim.__tv_nsec / 1000000000.0; #else return (gdouble)stat->st_mtim.tv_sec + stat->st_mtim.tv_nsec / 1000000000.0; #endif diff --git a/src/rmlint.c b/src/rmlint.c index 4da5ecbfe..101e05169 100644 --- a/src/rmlint.c +++ b/src/rmlint.c @@ -23,6 +23,10 @@ * **/ +#if defined(__sun) +#define _POSIX_C_SOURCE 200809L +#endif + #include #include #include