[erlang-patches] [PATCH] make os_mon compile on NetBSD 4.0

Per Hedeland <>
Fri Aug 22 00:31:22 CEST 2008

Björn-Egil Dahlberg <> wrote:
>os_mon is not supported for NetBSD nor is it prioritized at the moment.
>Regarding compiling error. I have compiled r12b-3 on NetBSD 3.0 and 
>there was no errors. I do not have any 4.0 machines available so i 
>cannot reproduce this build error.

The problem is that NetBSD had apparently forgotten its heritage in 3.x,
but has remembered it again in 4.0 and now pre-#define's __unix__ as it
should. This leads to the BSD4_4 #define getting pulled in from
<sys/param.h> and subsequently the #include <vm/vm_param.h> breaking the
compile, since there is no /usr/include/vm directory on NetBSD.

Below is a very minimal fix that allows the compile to succeed on NetBSD
4.0 - I don't think anyone will construe it as a commitment from the OTP
group to support os_mon on NetBSD, in particular since any attempt to
actually use it will just result in
{error,{unsupported_os,{unix,netbsd}}} - but it's annoying to have the
default build break because of this.

--Per Hedeland

--- lib/os_mon/c_src/memsup.c.orig	2007-11-26 19:55:46.000000000 +0100
+++ lib/os_mon/c_src/memsup.c	2008-08-21 17:07:22.000000000 +0200
@@ -98,7 +98,7 @@
 #ifdef BSD4_4
 #include <sys/types.h>
 #include <sys/sysctl.h>
-#ifndef __OpenBSD__
+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
 #include <vm/vm_param.h>
 #ifdef __FreeBSD__

More information about the erlang-patches mailing list