std/os/sysmon: guard sysctlbyname binding for static Linux
ober
539f03869a6dab91f76c96bfadc72625ccee0b96
--- a/lib/std/os/sysmon.sls +++ b/lib/std/os/sysmon.sls @@ -148,9 +148,15 @@ (sysmon-cpu-percent-set! mon (max 0.0 (min 100.0 pct))))]))) ;; Sysctl wrapper used by both macOS and BSD. + ;; Linux has no sysctlbyname, so guard the binding — on a static Linux + ;; build the symbol is absent from Sforeign_symbol and an unguarded + ;; foreign-procedure form raises at library visit time. sysctl-read is + ;; already wrapped in (guard (e [#t #f]) ...), so a #f here turns into a + ;; clean fallback. (define c-sysctlbyname - (foreign-procedure "sysctlbyname" - (string u8* u8* void* size_t) int)) + (guard (e [#t #f]) + (foreign-procedure "sysctlbyname" + (string u8* u8* void* size_t) int))) (define (sysctl-read name nbytes) ;; Returns a fresh bytevector on success, or #f.