diff --git a/src/xpdev/Common.gmake b/src/xpdev/Common.gmake
index 81edcbc9ea60686a63d36bc8ed1fe5d0c10abe4b..b6e7a513916788fb2164a76b53db20543f996bb2 100644
--- a/src/xpdev/Common.gmake
+++ b/src/xpdev/Common.gmake
@@ -14,7 +14,7 @@ ifndef VERBOSE
 endif
 
 # Compiler-specific options
-CFLAGS	+=	-MMD -Wall
+CFLAGS	+=	-MMD
 CCPRE	?=	gcc
 ifdef BUILD_DEPENDS
  CC	=	$(XPDEV)../build/mkdep -a
@@ -54,7 +54,11 @@ else
  ifeq ($(os),openbsd)
   DELETE :=	rm -f
  else
-  DELETE	=	rm -fv
+  ifeq ($(os),sunos)
+   DELETE :=	rm -f
+  else
+   DELETE	=	rm -fv
+  endif
  endif
 endif
 
@@ -112,8 +116,11 @@ else
      PTHREAD_LDFLAGS    += -lpthread
      XP_SEM    := 1
     else
-     ifeq ($(os),solaris)  # Solaris
+     ifeq ($(os),sunos)  # Solaris
+      XP_SEM :=    1
       PTHREAD_CFLAGS    +=    -D_POSIX_PTHREAD_SEMANTICS
+      PTHREAD_CFLAGS    += -DUSE_XP_SEMAPHORES
+      PTHREAD_LDFLAGS    +=    -lpthread
      else            # Linux / Other UNIX
       XP_SEM :=    1
       PTHREAD_CFLAGS    += -DUSE_XP_SEMAPHORES
diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index bd4c83a717131333fb3ca917f8141fa970b32aeb..770dc8456ce37beaa6b7b7a59c508f20ad0664a5 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -62,6 +62,10 @@
 		#include <sys/vfs.h>    /* statfs() */
 	#endif
 
+	#if defined(__solaris__)
+		#include <sys/statvfs.h>
+	#endif
+
 #endif /* __unix__ */
 
 #if defined(__WATCOMC__)
@@ -719,6 +723,17 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit)
 		fs.f_bavail/=unit;
     return fs.f_bsize * fs.f_bavail;
     
+#elif defined(__solaris__)
+
+	struct statvfs fs;
+
+    if (statvfs(path, &fs) < 0)
+    	return 0;
+
+	if(unit>1)
+		fs.f_bavail/=unit;
+    return fs.f_bsize * fs.f_bavail;
+    
 #else
 
 	fprintf(stderr,"\n*** !Missing getfreediskspace implementation ***\n");
diff --git a/src/xpdev/filewrap.c b/src/xpdev/filewrap.c
index aaf7310ecfa2ade72265875bbe830e3e750eedee..e8d118609acdbeb0c8b67210a69bfab2e7a088b1 100644
--- a/src/xpdev/filewrap.c
+++ b/src/xpdev/filewrap.c
@@ -108,7 +108,7 @@ int DLLCALL lock(int fd, long pos, long len)
 			return(-1);
 	#endif
 
-	#if !defined(F_SANEWRLCKNO) && !defined(__QNX__)
+	#if !defined(F_SANEWRLCKNO) && !defined(__QNX__) && !defined(__solaris__)
 		/* use flock (doesn't work over NFS) */
 		if(flock(fd,LOCK_EX|LOCK_NB)!=0 && errno != EOPNOTSUPP)
 			return(-1);
@@ -135,7 +135,7 @@ int DLLCALL unlock(int fd, long pos, long len)
 		return(-1);
 #endif
 
-#if !defined(F_SANEUNLCK) && !defined(__QNX__)
+#if !defined(F_SANEUNLCK) && !defined(__QNX__) && !defined(__solaris__)
 	/* use flock (doesn't work over NFS) */
 	if(flock(fd,LOCK_UN|LOCK_NB)!=0 && errno != EOPNOTSUPP)
 		return(-1);
@@ -182,7 +182,7 @@ int DLLCALL sopen(const char *fn, int access, int share, ...)
 	}
 #endif
 
-#ifndef F_SANEWRLCKNO
+#if !defined(F_SANEWRLCKNO) && !defined(__QNX__) && !defined(__solaris__)
 	/* use flock (doesn't work over NFS) */
 	if(share==SH_DENYRW)
 		flock_op|=LOCK_EX;
diff --git a/src/xpdev/filewrap.h b/src/xpdev/filewrap.h
index 61a0b0d2666ecbe5a66406af91a4ed0efa7806e0..994c743581c3e92ea8f1cee919966a630bacd5b6 100644
--- a/src/xpdev/filewrap.h
+++ b/src/xpdev/filewrap.h
@@ -70,6 +70,11 @@
 #elif defined(__unix__)
 
 	#include <fcntl.h>
+	#ifdef __solaris__
+		#define LOCK_NB	1
+		#define LOCK_SH 2
+		#define LOCK_EX 4
+	#endif
 
 	#ifdef __QNX__
 		#include <share.h>
diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h
index 25af0e2f26660a342ec168070d0ae8bf537893ed..5c1ac21713280e7e0026c01f6bc0b72542eb07d0 100644
--- a/src/xpdev/genwrap.h
+++ b/src/xpdev/genwrap.h
@@ -263,7 +263,8 @@ extern "C" {
 #endif
 
 #if defined(__solaris__)
-	#define CTIME_R(x,y)	ctime_r(x,y,sizeof y)
+	#define CTIME_R(x,y)	ctime_r(x,y)
+	/* #define CTIME_R(x,y)	ctime_r(x,y,sizeof y) */
 #else
 	#define CTIME_R(x,y)	ctime_r(x,y)
 #endif
diff --git a/src/xpdev/sockwrap.h b/src/xpdev/sockwrap.h
index c283acfbb1d7f26bf7c2448f85feb31c28f7b8bb..eaf86a37d3ebf9c69ff67b732814b70335a28dec 100644
--- a/src/xpdev/sockwrap.h
+++ b/src/xpdev/sockwrap.h
@@ -68,6 +68,7 @@
 #include <unistd.h>			/* close */
 #if defined(__solaris__)
 	#include <sys/filio.h>  /* FIONBIO */
+	#define INADDR_NONE -1L
 #else
 	#include <sys/ioctl.h>	/* FIONBIO */
 #endif
diff --git a/src/xpdev/xpsem.h b/src/xpdev/xpsem.h
index 11446218b77680c5763f4486a6b145d0caf99b59..86e1928f1e152f077675bc06a725b23058568ad7 100644
--- a/src/xpdev/xpsem.h
+++ b/src/xpdev/xpsem.h
@@ -54,8 +54,22 @@ typedef struct xp_sem *xp_sem_t;
 #define SEM_FAILED	((xp_sem_t *)0)
 #define SEM_VALUE_MAX	UINT_MAX
 
+#if defined(__cplusplus)
+#define __BEGIN_DECLS   extern "C" {
+#define __END_DECLS     }
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+#define __P(protos)     ()              /* traditional C preprocessor */
+/* full-blown ANSI C */
+/* #define __P(protos)     protos */
+
+#ifdef __solaris__
+typedef unsigned int	u_int32_t;
+#endif
+
 #ifndef KERNEL
-#include <sys/cdefs.h>
 
 __BEGIN_DECLS
 int	 xp_sem_init __P((xp_sem_t *, int, unsigned int));