aboutsummaryrefslogtreecommitdiff
path: root/util/cacheinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/cacheinfo.c')
-rw-r--r--util/cacheinfo.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index ea6f3e99bf..d94dc6adc8 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -93,10 +93,16 @@ static void sys_cache_info(int *isize, int *dsize)
static void sys_cache_info(int *isize, int *dsize)
{
# ifdef _SC_LEVEL1_ICACHE_LINESIZE
- *isize = sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
+ int tmp_isize = (int) sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
+ if (tmp_isize > 0) {
+ *isize = tmp_isize;
+ }
# endif
# ifdef _SC_LEVEL1_DCACHE_LINESIZE
- *dsize = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
+ int tmp_dsize = (int) sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
+ if (tmp_dsize > 0) {
+ *dsize = tmp_dsize;
+ }
# endif
}
#endif /* sys_cache_info */