summaryrefslogtreecommitdiffstats
path: root/solaris/Platform.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-05-19 19:00:44 +0200
committercgzones <cgzones@googlemail.com>2021-05-20 16:43:40 +0200
commitfdda291a0ea22508c2f1d4683bd9cde02ddb2427 (patch)
tree30cb5d9270b3ab30b9fc4cb457716df6efc42de1 /solaris/Platform.h
parent4676e35f425aa674fea23745f1628102268f9071 (diff)
Solaris: add kstat lookup wrappers
The system interfaces kstat_lookup() and kstat_data_lookup() take a non-constant string parameter, but passing string literals is valid. Add wrapper functions to ignore all the const-discard warnings.
Diffstat (limited to 'solaris/Platform.h')
-rw-r--r--solaris/Platform.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/solaris/Platform.h b/solaris/Platform.h
index 95a7ceb1..fc2826bb 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -11,6 +11,7 @@ in the source distribution for its full text.
#include "config.h" // IWYU pragma: keep
+#include <kstat.h>
#include <libproc.h>
#include <signal.h>
#include <stdbool.h>
@@ -109,4 +110,16 @@ static inline void Platform_gettime_monotonic(uint64_t* msec) {
Generic_gettime_monotonic(msec);
}
+static inline void* kstat_data_lookup_wrapper(kstat_t* ksp, const char* name) {
+IGNORE_WCASTQUAL_BEGIN
+ return kstat_data_lookup(ksp, (char*)name);
+IGNORE_WCASTQUAL_END
+}
+
+static inline kstat_t* kstat_lookup_wrapper(kstat_ctl_t* kc, const char* ks_module, int ks_instance, const char* ks_name) {
+IGNORE_WCASTQUAL_BEGIN
+ return kstat_lookup(kc, (char*)ks_module, ks_instance, (char*)ks_name);
+IGNORE_WCASTQUAL_END
+}
+
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy