$NetBSD$

--- src/dmd/backend/os.c.orig	2010-12-20 20:02:36.000000000 +0000
+++ src/dmd/backend/os.c
@@ -26,7 +26,7 @@
 #include <sys\stat.h>
 #endif
 
-#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
+#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || __NetBSD__
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -658,7 +658,7 @@ int os_file_exists(const char *name)
     if (!find)
         return 0;
     return (find->attribute & FA_DIREC) ? 2 : 1;
-#elif linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
+#elif linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || __NetBSD__
     struct stat buf;
 
     return stat(name,&buf) == 0;        /* file exists if stat succeeded */
@@ -735,7 +735,7 @@ char *file_8dot3name(const char *filenam
 
 int file_write(char *name, void *buffer, unsigned len)
 {
-#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
+#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || __NetBSD__
     int fd;
     ssize_t numwritten;
 
@@ -811,7 +811,7 @@ err:
 
 int file_createdirs(char *name)
 {
-#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
+#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || __NetBSD__
     return 1;
 #endif
 #if _WIN32
@@ -861,7 +861,7 @@ int os_critsecsize()
 }
 #endif
 
-#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
+#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || __NetBSD__
 int os_critsecsize()
 {
     return sizeof(pthread_mutex_t);
