Index: trunk/src/VBox/Additions/x11/xclient/Makefile.kmk
===================================================================
--- trunk/src/VBox/Additions/x11/xclient/Makefile.kmk	(revision 6290)
+++ trunk/src/VBox/Additions/x11/xclient/Makefile.kmk	(revision 6356)
@@ -19,4 +19,5 @@
 include	$(PATH_KBUILD)/header.kmk
 
+if1of ($(BUILD_TARGET),linux l4)
 ifneq ($(USERNAME),bird) # crap
  PROGRAMS = vboxadd-xclient
@@ -27,5 +28,5 @@
 vboxadd-xclient_TEMPLATE = VBOXLNX32GUESTR3EXE
 vboxadd-xclient_SOURCES  = clipboard.cpp main.cpp
-vboxadd-xclient_DEFS    += CLIPBOARD_LINUX
+vboxadd-xclient_DEFS    += VBOX_X11_CLIPBOARD
 
 ifdef LINUX_SEAMLESS_GUEST
@@ -78,4 +79,20 @@
  endif
 endif
+endif # target linux l4
+
+ifeq ($(BUILD_TARGET),solaris)
+PROGRAMS = VBoxClient
+
+VBoxClient_TEMPLATE = VBOXGUESTR3EXE
+VBoxClient_DEFS    += VBOX_X11_CLIPBOARD VBOX_HGCM
+VBoxClient_SOURCES  = \
+	clipboard-new.cpp \
+	main.cpp
+VBoxClient_LIBS = \
+	$(VBOX_LIB_VBGL_R3) \
+	$(VBOX_LIB_IPRT_GUEST_R3) \
+	X11 \
+	Xt
+endif # target solaris
 
 include	$(PATH_KBUILD)/footer.kmk
Index: trunk/src/VBox/Additions/x11/xclient/main.cpp
===================================================================
--- trunk/src/VBox/Additions/x11/xclient/main.cpp	(revision 6290)
+++ trunk/src/VBox/Additions/x11/xclient/main.cpp	(revision 6356)
@@ -26,12 +26,7 @@
 
 #include <sys/types.h>
-#include <sys/stat.h>     /* For umask */
-#include <fcntl.h>        /* For open */
 #include <stdlib.h>       /* For exit */
 #include <unistd.h>
 #include <getopt.h>
-
-#include <sys/time.h>     /* For getrlimit */
-#include <sys/resource.h> /* For getrlimit */
 
 #include <X11/Xlib.h>
@@ -45,48 +40,4 @@
 
 static bool gbDaemonise = true;
-
-/**
- * Go through the long Un*x ritual required to become a daemon process.
- */
-void vboxDaemonise(void)
-{
-    /** rlimit structure for finding out how many open files we may have. */
-    struct rlimit rlim;
-
-    /* To make sure that we are not currently a session leader, we must first fork and let
-       the parent process exit, as a newly created child is never session leader.  This will
-       allow us to call setsid() later. */
-    if (fork() != 0)
-    {
-        exit(0);
-    }
-    /* Find the maximum number of files we can have open and close them all. */
-    if (0 != getrlimit(RLIMIT_NOFILE, &rlim))
-    {
-        /* For some reason the call failed.  In that case we will just close the three
-           standard files and hope. */
-        rlim.rlim_cur = 3;
-    }
-    for (unsigned int i = 0; i < rlim.rlim_cur; ++i)
-    {
-        close(i);
-    }
-    /* Change to the root directory to avoid keeping the one we were started in open. */
-    chdir("/");
-    /* Set our umask to zero. */
-    umask(0);
-    /* And open /dev/null on stdin/out/err. */
-    open("/dev/null", O_RDONLY);
-    open("/dev/null", O_WRONLY);
-    dup(1);
-    /* Detach from the controlling terminal by creating our own session, to avoid receiving
-       signals from the old session. */
-    setsid();
-    /* And fork again, letting the parent exit, to make us a child of init and avoid zombies. */
-    if (fork() != 0)
-    {
-        exit(0);
-    }
-}
 
 /**
@@ -110,5 +61,5 @@
         return 0;
     }
-#ifdef CLIPBOARD_LINUX
+#ifdef VBOX_X11_CLIPBOARD
     vboxClipboardDisconnect();
 #endif
@@ -157,7 +108,12 @@
         }
     }
+    gbDaemonise = false; // ram
     if (gbDaemonise)
     {
-        vboxDaemonise();
+        if (VbglR3Daemonize(0, 0) != 0)
+        {
+            LogRel(("VBoxService: failed to daemonize. exiting."));
+            return 1;
+        }
     }
     /* Initialise our runtime before all else. */
@@ -178,5 +134,5 @@
     /* Set an X11 error handler, so that we don't die when we get unavoidable errors. */
     XSetErrorHandler(vboxClientXLibErrorHandler);
-#ifdef CLIPBOARD_LINUX
+#ifdef VBOX_X11_CLIPBOARD
     /* Connect to the host clipboard. */
     LogRel(("VBoxService: starting clipboard Guest Additions...\n"));
@@ -186,5 +142,5 @@
         LogRel(("VBoxService: vboxClipboardConnect failed with rc = %Rrc\n", rc));
     }
-#endif  /* CLIPBOARD_LINUX defined */
+#endif  /* VBOX_X11_CLIPBOARD defined */
 #ifdef SEAMLESS_LINUX
     try
@@ -208,13 +164,13 @@
     }
 #endif /* SEAMLESS_LINUX defined */
-#ifdef CLIPBOARD_LINUX
+#ifdef VBOX_X11_CLIPBOARD
     LogRel(("VBoxService: connecting to the shared clipboard service.\n"));
     vboxClipboardMain();
     vboxClipboardDisconnect();
-#else  /* CLIPBOARD_LINUX not defined */
+#else  /* VBOX_X11_CLIPBOARD not defined */
     LogRel(("VBoxService: sleeping...\n"));
     pause();
     LogRel(("VBoxService: exiting...\n"));
-#endif  /* CLIPBOARD_LINUX not defined */
+#endif  /* VBOX_X11_CLIPBOARD not defined */
 #ifdef SEAMLESS_LINUX
     try
