diff --git a/open-vm-tools/README b/open-vm-tools/README
index bba66a9..ffbff94 100644
--- a/open-vm-tools/README
+++ b/open-vm-tools/README
@@ -94,6 +94,16 @@ should work:
 (*)FreeBSD 6.2 (i386 & x86_64):
 ./configure LDFLAGS="-L/usr/local/lib"
 
+(*)DragonFlyBSD 2.9 (i386):
+You will need the following packages from pkgsrc in order to build:
+
+- devel/gettext-lib
+- textproc/icu
+- textproc/uriparser
+- x11/gtkmm
+
+./configure --without-dnet LDFLAGS="-L/usr/pkg/lib" CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/uriparser"
+
 ================================================================================
 Other resources:
 	There are also open-source video & mouse drivers for Xorg/XFree86 that
diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac
index b31762d..c877b75 100644
--- a/open-vm-tools/configure.ac
+++ b/open-vm-tools/configure.ac
@@ -127,6 +127,9 @@ case "$host_os" in
    [linux*])
       os="linux"
       ;;
+   [dragonfly*])
+      os="dragonfly"
+      ;;
    [freebsd*])
       os="freebsd"
       ;;
@@ -150,6 +153,15 @@ if test "$with_kernel_modules" = "yes"; then
          fi
          ;;
 
+      dragonfly)
+         dragonfly_sysdir=/usr/src/sys
+         if test -n "$SYSDIR"; then
+            dragonfly_sysdir="$SYSDIR"
+         fi
+         if test ! -f "$dragonfly_sysdir/conf/kmod.mk"; then
+            AC_MSG_ERROR([DragonFlyBSD kernel tree not found. Please use 'make src-create' as root under /usr directory (or provide the location using SYSDIR) or configure using --without-kernel-modules.])
+         fi
+	 ;;
       freebsd)
          freebsd_sysdir=/usr/src/sys
          if test -n "$SYSDIR"; then
@@ -988,6 +1000,24 @@ if test "$os" = "linux"; then
    buildHgfsmounter=yes
 fi
 
+if test "$os" = "dragonfly"; then
+   MODULES_DIR="/boot/kernel"
+
+   MODULES="$MODULES vmmemctl"
+   MODULES="$MODULES vmxnet"
+   MODULES="$MODULES vmblock"
+#  MODULES="$MODULES vmblock vmhgfs"
+   buildHgfsmounter=yes
+
+   if test "$with_kernel_modules" = "yes"; then
+      echo "*********************************************************************"
+      echo "   You are building DragonFlyBSD kernel modules. Make sure you use   "
+      echo "   'make' to build open-vm-tools, and not GNU make ('gmake').        "
+      echo "*********************************************************************"
+   fi
+fi
+
+
 if test "$os" = "freebsd"; then
    MODULES_DIR="/boot/modules"
 
@@ -1056,6 +1086,8 @@ fi
 AM_CONDITIONAL(BUILD_HGFSMOUNTER, test "$buildHgfsmounter" = "yes")
 AM_CONDITIONAL(LINUX, test "$os" = "linux")
 AM_CONDITIONAL(SOLARIS, test "$os" = "solaris")
+AM_CONDITIONAL(DRAGONFLY, test "$os" = "dragonfly")
+AM_CONDITIONAL(DRAGONFLY_CUSTOM_SYSDIR, test "$os" = "dragonfly" -a -n "$SYSDIR")
 AM_CONDITIONAL(FREEBSD, test "$os" = "freebsd")
 AM_CONDITIONAL(FREEBSD_CUSTOM_SYSDIR, test "$os" = "freebsd" -a -n "$SYSDIR")
 AM_CONDITIONAL(THIRTY_TWO_BIT_USERSPACE, test "$userSpaceBitness" = "32")
@@ -1142,7 +1174,7 @@ AC_SUBST([TEST_PLUGIN_INSTALLDIR])
 AC_SUBST([COMMON_PLUGIN_INSTALLDIR])
 AC_SUBST([VMSVC_PLUGIN_INSTALLDIR])
 AC_SUBST([VMUSR_PLUGIN_INSTALLDIR])
-if test "$os" = "freebsd" -a -n "$SYSDIR"; then
+if test "$os" = "freebsd" -o test "$os" = "dragonfly" -a -n "$SYSDIR"; then
    # If SYSDIR is not defined, AC_SUBST expands to nothing, so we need something
    # inside this block.
    true
diff --git a/open-vm-tools/hgfsmounter/hgfsmounter.c b/open-vm-tools/hgfsmounter/hgfsmounter.c
index e4e488d..be2e560 100644
--- a/open-vm-tools/hgfsmounter/hgfsmounter.c
+++ b/open-vm-tools/hgfsmounter/hgfsmounter.c
@@ -36,7 +36,7 @@
 #   include <mntent.h>
 #endif
 
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 #   include <sys/uio.h>
 #   include <sys/param.h>
 
@@ -64,7 +64,7 @@
 #   define MS_NOCLUSTERW MNT_NOCLUSTERW
 #   define MS_REMOUNT MNT_RELOAD
 
-#  if defined(__FreeBSD__)
+#  if defined(__FreeBSD__) || defined(__DragonFly__)
 #     define MS_NOATIME MNT_NOATIME
 #  elif defined(__APPLE__)
 /*
@@ -101,7 +101,7 @@
 #include "hgfsmounter_version.h"
 
 /* XXX embed_version.h does not currently support Mach-O binaries (OS X). */
-#if defined(linux) || defined(__FreeBSD__)
+#if defined(linux) || defined(__FreeBSD__) || defined(__DragonFly__)
 #  include "embed_version.h"
    VM_EMBED_VERSION(HGFSMOUNTER_VERSION_STRING);
 #endif
@@ -1114,6 +1114,8 @@ main(int argc,          // IN
    /* Go! */
 #if defined(linux)
    mntRes = mount(shareName, mountPoint, HGFS_NAME, flags, &mountInfo);
+#elif defined(__DragonFly__)
+   mntRes = mount(HGFS_NAME, mountPoint, flags, &mountInfo);
 #elif defined(__FreeBSD__)
    {
       struct iovec iov[] = {{"fstype", sizeof("fstype")},
diff --git a/open-vm-tools/lib/dynxdr/dynxdr.c b/open-vm-tools/lib/dynxdr/dynxdr.c
index 4c660ce..7fea3a3 100644
--- a/open-vm-tools/lib/dynxdr/dynxdr.c
+++ b/open-vm-tools/lib/dynxdr/dynxdr.c
@@ -54,7 +54,7 @@ typedef struct DynXdrData {
  * Mac OS X, FreeBSD and Solaris don't take a const parameter to the
  * "x_getpostn" function.
  */
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(sun)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(sun) || defined(__DragonFly__)
 #  define DYNXDR_GETPOS_CONST
 #else
 #  define DYNXDR_GETPOS_CONST const
diff --git a/open-vm-tools/lib/file/fileIO.c b/open-vm-tools/lib/file/fileIO.c
index 951e095..b715adc 100644
--- a/open-vm-tools/lib/file/fileIO.c
+++ b/open-vm-tools/lib/file/fileIO.c
@@ -254,7 +254,7 @@ FileIO_Lock(FileIODescriptor *file,  // IN/OUT:
 
    ASSERT(file);
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
    if (access & FILEIO_OPEN_LOCKED) {
       int err;
 
@@ -293,7 +293,7 @@ FileIO_Lock(FileIODescriptor *file,  // IN/OUT:
    }
 #else
    ASSERT(file->lockToken == NULL);
-#endif // !__FreeBSD__ && !sun
+#endif // !__FreeBSD__ && !sun && !__DragonFly__
 
    return ret;
 }
@@ -323,7 +323,7 @@ FileIO_Unlock(FileIODescriptor *file)  // IN/OUT:
 
    ASSERT(file);
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
    if (file->lockToken != NULL) {
       int err;
 
@@ -340,7 +340,8 @@ FileIO_Unlock(FileIODescriptor *file)  // IN/OUT:
    }
 #else
    ASSERT(file->lockToken == NULL);
-#endif // !__FreeBSD__ && !sun
+#endif // !__FreeBSD__ && !sun && !__DragonFly__
+
 
    return ret;
 }
@@ -374,7 +375,7 @@ FileIO_Filename(FileIODescriptor *fd)  // IN:
 
 
 #if defined(_WIN32) || defined(__linux__) || defined(__APPLE__) || \
-    defined(__FreeBSD__) || defined(sun)
+    defined(__FreeBSD__) || defined(sun) || defined(__DragonFly__)
 /*
  *----------------------------------------------------------------------
  *
diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c
index 2b39d03..b742a3a 100644
--- a/open-vm-tools/lib/file/fileIOPosix.c
+++ b/open-vm-tools/lib/file/fileIOPosix.c
@@ -65,7 +65,7 @@
 #include <dlfcn.h>
 #include <sys/xattr.h>
 #else
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/param.h>
 #include <sys/mount.h>
 #else
@@ -758,7 +758,7 @@ FileIO_Create(FileIODescriptor *file,   // OUT:
    if (access & FILEIO_OPEN_EXCLUSIVE_LOCK_MACOS) {
       flags |= O_EXLOCK;
    }
-#elif !defined(__FreeBSD__) && !defined(sun) && !defined(N_PLAT_NLM)
+#elif !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__) && !defined(N_PLAT_NLM)
    /*
     * If FILEIO_OPEN_EXCLUSIVE_LOCK or FILEIO_OPEN_MULTIWRITER_LOCK or
     * (FILEIO_OPEN_ACCESS_READ | FILEIO_OPEN_LOCKED) are passed, and we are
@@ -1577,7 +1577,7 @@ FileIO_Writev(FileIODescriptor *fd,  // IN:
 
 
 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||\
-    defined(sun)
+    defined(sun) || defined(__DragonFly__)
 
 /*
  *----------------------------------------------------------------------
@@ -1758,7 +1758,7 @@ exit:
    return fret;
 }
 #endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||
-          defined(sun) */
+          defined(sun) || defined(__DragonFly__) */
 #endif /* !defined(N_PLAT_NLM) */
 
 /*
diff --git a/open-vm-tools/lib/file/fileLockPosix.c b/open-vm-tools/lib/file/fileLockPosix.c
index 04a3d0a..198be18 100644
--- a/open-vm-tools/lib/file/fileLockPosix.c
+++ b/open-vm-tools/lib/file/fileLockPosix.c
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h> /* Needed before sys/vfs.h with glibc 2.0 --hpreg */
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
 #if defined(__APPLE__)
 #include <sys/param.h> 
 #include <sys/mount.h> 
@@ -74,7 +74,7 @@
  * into the log file.
  */
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 /*
  *----------------------------------------------------------------------
  *
@@ -1253,4 +1253,4 @@ FileLockWriteFile(FILELOCK_FILE_HANDLE handle,  // IN:
    NOT_IMPLEMENTED();
 }
 
-#endif /* !__FreeBSD__ && !sun */
+#endif /* !__FreeBSD__ && !sun && !__DragonFly__ */
diff --git a/open-vm-tools/lib/file/filePosix.c b/open-vm-tools/lib/file/filePosix.c
index fce7646..a7d118f 100644
--- a/open-vm-tools/lib/file/filePosix.c
+++ b/open-vm-tools/lib/file/filePosix.c
@@ -24,7 +24,7 @@
 
 #include <sys/types.h> /* Needed before sys/vfs.h with glibc 2.0 --hpreg */
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 # include <sys/param.h>
 #else
 # if !defined(__APPLE__)
@@ -71,7 +71,7 @@
 
 #include "unicodeOperations.h"
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 #if !defined(__APPLE__)
 static char *FilePosixLookupMountPoint(char const *canPath, Bool *bind);
 #endif
@@ -371,7 +371,7 @@ FileAttributes(ConstUnicode pathName,  // IN:
  *----------------------------------------------------------------------
  */
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 Bool
 File_IsRemote(ConstUnicode pathName)  // IN: Path name
 {
@@ -410,7 +410,7 @@ File_IsRemote(ConstUnicode pathName)  // IN: Path name
 #endif
    }
 }
-#endif /* !FreeBSD && !sun */
+#endif /* !FreeBSD && !sun && !DragonFly */
 
 
 /*
@@ -675,7 +675,7 @@ File_GetTimes(ConstUnicode pathName,       // IN:
     * XXX atime is almost always MAX.
     */
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
    /*
     * FreeBSD: All supported versions have timestamps with nanosecond
     * resolution. FreeBSD 5+ has also file creation time.
@@ -879,7 +879,7 @@ File_SetFilePermissions(ConstUnicode pathName,  // IN:
 }
 
 
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 /*
  *-----------------------------------------------------------------------------
  *
@@ -1860,7 +1860,7 @@ File_IsSameFile(ConstUnicode path1,  // IN:
 }
 
 
-#endif /* !FreeBSD && !sun */
+#endif /* !FreeBSD && !sun && !DragonFly */
 
 
 /*
diff --git a/open-vm-tools/lib/hgfs/hgfsEscape.c b/open-vm-tools/lib/hgfs/hgfsEscape.c
index c191f6d..b1ed472 100644
--- a/open-vm-tools/lib/hgfs/hgfsEscape.c
+++ b/open-vm-tools/lib/hgfs/hgfsEscape.c
@@ -40,7 +40,7 @@
 #ifdef __KERNEL__
 #  include "driver-config.h"
 #  include <linux/string.h>
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __DragonFly__
 #   if defined _KERNEL
 #      include <sys/libkern.h>
 #      define strchr(s,c)       index(s,c)
diff --git a/open-vm-tools/lib/hgfsHelper/hgfsHelperPosix.c b/open-vm-tools/lib/hgfsHelper/hgfsHelperPosix.c
index ac65f51..37b4c70 100644
--- a/open-vm-tools/lib/hgfsHelper/hgfsHelperPosix.c
+++ b/open-vm-tools/lib/hgfsHelper/hgfsHelperPosix.c
@@ -24,7 +24,7 @@
  *
  */
 
-#if !defined __linux__ && !defined __FreeBSD__ && !defined sun && !defined __APPLE__
+#if !defined __linux__ && !defined __FreeBSD__ && !defined sun && !defined __APPLE__ && !defined __DragonFly__
 #   error This file should not be compiled
 #endif
 
@@ -65,7 +65,7 @@
 Bool
 HgfsHlpr_QuerySharesDefaultRootPath(Unicode *hgfsRootPath)
 {
-#if defined __FreeBSD__
+#if defined __FreeBSD__ || defined __DragonFly__
    return FALSE;
 #else
    ASSERT(hgfsRootPath != NULL);
diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c
index af28c2c..a5e4f50 100644
--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
+++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
@@ -2445,10 +2445,18 @@ HgfsGetSearchResult(HgfsHandle handle,         // IN: Handle to search
       /*
        * Make sure the name will not overrun the d_name buffer, the end of which
        * is also the end of the DirectoryEntry.
+       * DragonFlyBSD doesn't have d_reclen in struct dirent, they use a macro
+       * to calculate d_reclen.
        */
+#if !defined(__DragonFly__)
       ASSERT(offsetof(DirectoryEntry, d_name) + nameLen < originalDent->d_reclen);
 
       dent = malloc(originalDent->d_reclen);
+#else
+      ASSERT(offsetof(DirectoryEntry, d_name) + nameLen < _DIRENT_DIRSIZ(originalDent));
+
+      dent = malloc(_DIRENT_DIRSIZ(originalDent));
+#endif
       if (dent == NULL) {
          goto out;
       }
@@ -2458,7 +2466,9 @@ HgfsGetSearchResult(HgfsHandle handle,         // IN: Handle to search
        * at the top of hgfsServerInt.h, you'll see that on Windows we only
        * define d_reclen and d_name, as those are the only fields we need.
        */
+#if !defined(__DragonFly__)
       dent->d_reclen = originalDent->d_reclen;
+#endif
       memcpy(dent->d_name, originalDent->d_name, nameLen);
       dent->d_name[nameLen] = 0;
    }
@@ -4473,7 +4483,10 @@ HgfsServerGetDents(HgfsGetNameFunc getName,     // IN: Function to get name
          LOG(4, ("%s: Couldn't allocate dentry memory\n", __FUNCTION__));
          goto error;
       }
+
+#if !defined(__DragonFly__)
       pDirEntry->d_reclen = (unsigned short)newDirEntryLen;
+#endif
       memcpy(pDirEntry->d_name, name, len);
       pDirEntry->d_name[len] = 0;
 
diff --git a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
index b6b0b94..757dfa2 100644
--- a/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
+++ b/open-vm-tools/lib/hgfsServer/hgfsServerLinux.c
@@ -40,7 +40,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #   include <sys/param.h>
 #else
 #   include <wchar.h>
@@ -156,7 +156,7 @@ getdents_linux(unsigned int fd,
 #   endif
 }
 #      define getdents getdents_linux
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 #define getdents(fd, dirp, count)                                             \
 ({                                                                            \
    long basep;                                                                \
@@ -3211,14 +3211,22 @@ HgfsServerScandir(char const *baseDir,      // IN: Directory to search in
           * Allocate the new dent and set it up. We do a straight memcpy of
           * the entire record to avoid dealing with platform-specific fields.
           */
+#if !defined(__DragonFly__)
          myDents[myNumDents] = malloc(newDent->d_reclen);
+#else
+         myDents[myNumDents] = malloc(_DIRENT_DIRSIZ(newDent));
+#endif
          if (myDents[myNumDents] == NULL) {
             status = ENOMEM;
             goto exit;
          }
 
          if (HgfsConvertToUtf8FormC(newDent->d_name, sizeof newDent->d_name)) {
+#if !defined(__DragonFly__)
             memcpy(myDents[myNumDents], newDent, newDent->d_reclen);
+#else
+            memcpy(myDents[myNumDents], newDent, _DIRENT_DIRSIZ(newDent));
+#endif
             /*
              * Dent is done. Bump the offset to the batched buffer to process the
              * next dent within it.
@@ -3235,7 +3243,11 @@ HgfsServerScandir(char const *baseDir,      // IN: Directory to search in
              */
             free(myDents[myNumDents]);
          }
+#if !defined(__DragonFly__)
          offset += newDent->d_reclen;
+#else
+         offset += _DIRENT_DIRSIZ(newDent);
+#endif
       }
    }
 
diff --git a/open-vm-tools/lib/include/codeset.h b/open-vm-tools/lib/include/codeset.h
index 236c6c8..2ebd399 100644
--- a/open-vm-tools/lib/include/codeset.h
+++ b/open-vm-tools/lib/include/codeset.h
@@ -63,6 +63,7 @@
  */
 
 #if defined(__FreeBSD__) || \
+    defined(__DragonFly__) || \
     defined(VMX86_SERVER) || \
     defined(__APPLE__) || \
     defined(N_PLAT_NLM) || \
diff --git a/open-vm-tools/lib/include/guest_os.h b/open-vm-tools/lib/include/guest_os.h
index c1d0e3c..d315146 100644
--- a/open-vm-tools/lib/include/guest_os.h
+++ b/open-vm-tools/lib/include/guest_os.h
@@ -93,6 +93,8 @@ typedef enum GuestOSType {
    GUEST_OS_WINEIGHT_64         = GUEST_OS_BASE + 55, // Windows 8 x64
    GUEST_OS_WINEIGHTSERVER_64   = GUEST_OS_BASE + 56, // Windows 8 Server X64
    GUEST_OS_VMKERNEL5           = GUEST_OS_BASE + 57, // ESX 5.x and later
+   GUEST_OS_DRAGONFLY		= GUEST_OS_BASE + 58,
+   GUEST_OS_DRAGONFLY_64	= GUEST_OS_BASE + 59,
 } GuestOSType;
 
 
@@ -120,6 +122,8 @@ typedef enum GuestOSFamilyType {
 
 #define ALLFREEBSD      (BS(FREEBSD) | BS(FREEBSD_64))
 
+#define ALLDRAGONFLY	(BS(DRAGONFLY) | BS(DRAGONFLY_64))
+
 #define ALLWINNET32	BS(WINNET)
 #define ALLWINNET64	BS(WINNET_64)
 #define ALLWINNET	(ALLWINNET32 | ALLWINNET64)
@@ -429,6 +433,9 @@ typedef enum GuestOSFamilyType {
 /* FreeBSD */
 #define STR_OS_FREEBSD "FreeBSD"
 
+/* DragonFlyBSD */
+#define STR_OS_DRAGONFLY "DragonFlyBSD"
+
 /* Solaris */
 #define STR_OS_SOLARIS "solaris"
 
diff --git a/open-vm-tools/lib/include/hgfsUtil.h b/open-vm-tools/lib/include/hgfsUtil.h
index ef9096d..e5c0440 100644
--- a/open-vm-tools/lib/include/hgfsUtil.h
+++ b/open-vm-tools/lib/include/hgfsUtil.h
@@ -47,6 +47,8 @@
     /* Include time.h in userspace code, but not in Solaris kernel code. */
 #   elif defined __FreeBSD__ && defined _KERNEL
     /* Do nothing. */
+#   elif defined __DragonFly__ && defined _KERNEL
+    /* Do nothing. */
 #   elif defined __APPLE__ && defined KERNEL
 #      include <sys/time.h>
 #   else
@@ -58,6 +60,7 @@
        !defined __timespec_defined && \
        !defined sun && \
        !defined __FreeBSD__ && \
+       !defined __DragonFly__ && \
        !__APPLE__ && \
        !defined _WIN32
 struct timespec {
@@ -73,7 +76,7 @@ struct timespec {
 #   if defined __KERNEL__ || defined _KERNEL || defined KERNEL
 #      if defined __linux__
 #         include <linux/errno.h>
-#      elif defined sun || defined __FreeBSD__ || defined __APPLE__
+#      elif defined sun || defined __FreeBSD__ || defined __APPLE__ || defined __DragonFly__
 #         include <sys/errno.h>
 #      endif
 #   else
diff --git a/open-vm-tools/lib/include/iovector.h b/open-vm-tools/lib/include/iovector.h
index e96d419..cf8dc62 100644
--- a/open-vm-tools/lib/include/iovector.h
+++ b/open-vm-tools/lib/include/iovector.h
@@ -32,7 +32,7 @@
 /*
  * Ugly definition of struct iovec.
  */
-#if defined(__linux__) || defined(sun) || defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(sun) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/uio.h>    // for struct iovec
 #else
 
diff --git a/open-vm-tools/lib/include/mntinfo.h b/open-vm-tools/lib/include/mntinfo.h
index 56a13f0..610ed85 100644
--- a/open-vm-tools/lib/include/mntinfo.h
+++ b/open-vm-tools/lib/include/mntinfo.h
@@ -34,7 +34,7 @@
 # include <limits.h>
 #elif defined(__linux__)
 # include <mntent.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 # include <sys/mount.h>
 #endif
 #include "posix.h"
@@ -106,7 +106,7 @@
 # define MNTINFO_FSTYPE(mnt)            mnt->mnt_type
 # define MNTINFO_MNTPT(mnt)             mnt->mnt_dir
 # define MNTINFO_MNT_IS_RO(mnt)         (hasmntopt((mnt), "rw") == NULL)
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 struct mntHandle {
    struct statfs *mountPoints;  // array of mountpoints per getmntinfo(3)
    int numMountPoints;          // number of elements in mntArray
diff --git a/open-vm-tools/lib/include/posix.h b/open-vm-tools/lib/include/posix.h
index c5f2db3..051b3a4 100644
--- a/open-vm-tools/lib/include/posix.h
+++ b/open-vm-tools/lib/include/posix.h
@@ -154,7 +154,7 @@ int Posix_Statfs(ConstUnicode pathName, struct statfs *statfsbuf);
 int Posix_GetGroupList(ConstUnicode user, gid_t group, gid_t *groups,
                        int *ngroups);
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
 int Posix_Mount(ConstUnicode source, ConstUnicode target,
                 const char *filesystemtype, unsigned long mountflags,
 		const void *data);
@@ -164,7 +164,7 @@ struct mntent *Posix_Getmntent(FILE *fp);
 struct mntent *Posix_Getmntent_r(FILE *fp, struct mntent *m,
                                  char *buf, int size);
 
-#endif // !defined(__APPLE__) && !defined(__FreeBSD__)
+#endif // !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
 #else  // !defined(sun)
 int Posix_Getmntent(FILE *fp, struct mnttab *mp);
 
diff --git a/open-vm-tools/lib/include/sigPosixRegs.h b/open-vm-tools/lib/include/sigPosixRegs.h
index 29cf1fe..670d77c 100644
--- a/open-vm-tools/lib/include/sigPosixRegs.h
+++ b/open-vm-tools/lib/include/sigPosixRegs.h
@@ -145,7 +145,7 @@
 #define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext->ss.esp)
 #define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext->ss.eip)
 #endif
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 #ifdef __x86_64__
 #define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.mc_rax)
 #define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.mc_rbx)
diff --git a/open-vm-tools/lib/include/su.h b/open-vm-tools/lib/include/su.h
index 3358863..64091ed 100644
--- a/open-vm-tools/lib/include/su.h
+++ b/open-vm-tools/lib/include/su.h
@@ -50,7 +50,7 @@ Bool Id_AuthCheck(char const *right,
                   char const *localizedDescription,
                   Bool showDialogIfNeeded);
 
-#elif (defined(__linux__) || defined(sun) || defined(__FreeBSD__)) && !defined(N_PLAT_NLM)
+#elif (defined(__linux__) || defined(sun) || defined(__FreeBSD__)) || defined(__DragonFly__) && !defined(N_PLAT_NLM)
 
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/open-vm-tools/lib/include/vm_product.h b/open-vm-tools/lib/include/vm_product.h
index fbacf0c..826c22e 100644
--- a/open-vm-tools/lib/include/vm_product.h
+++ b/open-vm-tools/lib/include/vm_product.h
@@ -556,6 +556,8 @@
 #  define PRODUCT_NAME_PLATFORM         PRODUCT_NAME " for Linux"
 #elif defined(_WIN32)
 #  define PRODUCT_NAME_PLATFORM         PRODUCT_NAME " for Windows"
+#elif defined(__DragonFly__)
+#  define PRODUCT_NAME_PLATFORM         PRODUCT_NAME " for DragonFlyBSD"
 #elif defined(__FreeBSD__)
 #  define PRODUCT_NAME_PLATFORM         PRODUCT_NAME " for FreeBSD"
 #elif defined(sun)
diff --git a/open-vm-tools/lib/include/vmblock.h b/open-vm-tools/lib/include/vmblock.h
index 58327ff..6d79370 100644
--- a/open-vm-tools/lib/include/vmblock.h
+++ b/open-vm-tools/lib/include/vmblock.h
@@ -86,11 +86,11 @@
 #ifndef _VMBLOCK_H_
 #define _VMBLOCK_H_
 
-#if defined(sun) || defined(__FreeBSD__)
+#if defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
 # include <sys/ioccom.h>
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 # include <sys/param.h>
 #endif
 
@@ -167,7 +167,7 @@
                                        "/" VMBLOCK_CONTROL_DEVNAME
 # define VMBLOCK_DEVICE_MODE            O_WRONLY
 
-#elif defined(sun) || defined(__FreeBSD__)
+#elif defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
 # define VMBLOCK_FS_NAME                "vmblock"
 # define VMBLOCK_MOUNT_POINT            "/var/run/" VMBLOCK_FS_NAME
 # define VMBLOCK_FS_ROOT                VMBLOCK_MOUNT_POINT
@@ -185,7 +185,7 @@
 #   define VMBLOCK_LIST_FILEBLOCKS       _IO('v', 3)
 #  endif
 
-# elif defined(__FreeBSD__)              /* } else if (FreeBSD) { */
+# elif defined(__FreeBSD__) || defined(__DragonFly__) /* } else if (FreeBSD) || (DragonFly){ */
    /*
     * Similar to Solaris, construct ioctl(2) commands for block operations.
     * Since the FreeBSD implementation does not change the user's passed-in
diff --git a/open-vm-tools/lib/include/vmblock_user.h b/open-vm-tools/lib/include/vmblock_user.h
index 13213ee..cf46eee 100644
--- a/open-vm-tools/lib/include/vmblock_user.h
+++ b/open-vm-tools/lib/include/vmblock_user.h
@@ -128,7 +128,7 @@ VMBLOCK_CONTROL(int fd, int op, const char *path)
    return write(fd, path, op);
 }
 
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 
 static INLINE int
 VMBLOCK_CONTROL(int fd, int cmd, const char *path)
diff --git a/open-vm-tools/lib/lock/ulSema.c b/open-vm-tools/lib/lock/ulSema.c
index c149b96..327323d 100644
--- a/open-vm-tools/lib/lock/ulSema.c
+++ b/open-vm-tools/lib/lock/ulSema.c
@@ -24,7 +24,7 @@
 #include <mach/task.h>
 #include <mach/semaphore.h>
 #else
-#if (_XOPEN_SOURCE < 600) && !defined(__FreeBSD__) && !defined(sun)
+#if (_XOPEN_SOURCE < 600) && !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 #undef _XOPEN_SOURCE
 #define _XOPEN_SOURCE 600
 #endif
@@ -331,6 +331,15 @@ MXUserTimedDown(NativeSemaphore *sema,  // IN:
    endTime.tv_sec = (time_t) (endNS / MXUSER_A_BILLION);
    endTime.tv_nsec = (long int) (endNS % MXUSER_A_BILLION);
 
+#if defined(__DragonFly__)
+      while(msecWait) {
+	      if (sem_trywait (sema) == 0) {
+		      return 0;
+	      }
+	      usleep (1000);
+	      msecWait--;
+      }
+#else
    do {
       err = (sem_timedwait(sema, &endTime) == -1) ? errno : 0;
 
@@ -345,6 +354,7 @@ MXUserTimedDown(NativeSemaphore *sema,  // IN:
          }
       }
    } while (err == EINTR);
+#endif
 
    return err;
 }
diff --git a/open-vm-tools/lib/misc/codesetOld.c b/open-vm-tools/lib/misc/codesetOld.c
index b56614a..062126f 100644
--- a/open-vm-tools/lib/misc/codesetOld.c
+++ b/open-vm-tools/lib/misc/codesetOld.c
@@ -70,7 +70,7 @@
 #endif
 
 
-#if defined(__FreeBSD__) || defined(sun)
+#if defined(__FreeBSD__) || defined(sun) || defined(__DragonFly__)
 static const char nul[] = {'\0', '\0'};
 #else
 static const wchar_t nul = L'\0';
@@ -650,7 +650,7 @@ CodeSetOldGetCodeSetFromLocale(void)
    codeset = Util_SafeStrdup(nl_langinfo_l(CODESET, new));
    freelocale(new);
 
-#elif defined(sun)
+#elif defined(sun) || defined(__DragonFly__)
 
    char *locale = setlocale(LC_CTYPE, NULL);
 
@@ -907,7 +907,7 @@ CodeSetOld_GenericToGenericDb(char const *codeIn,   // IN:
        * change bufIn so a simple cast is safe. --plangdale
        */
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__DragonFly__)
       status = iconv(cd, (char **)&bufIn, &sizeIn, &out, &outLeft);
 #else
       status = iconv(cd, &bufIn, &sizeIn, &out, &outLeft);
diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c
index 227764b..6d044f4 100644
--- a/open-vm-tools/lib/misc/hostinfoPosix.c
+++ b/open-vm-tools/lib/misc/hostinfoPosix.c
@@ -39,7 +39,7 @@
 #include <sys/systeminfo.h>
 #endif
 #include <sys/socket.h>
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 # include <sys/sysctl.h>
 #endif
 #if defined(__APPLE__)
@@ -52,7 +52,7 @@
 #include <mach/mach.h>
 #include <mach/mach_time.h>
 #include <sys/mman.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 #if !defined(RLIMIT_AS)
 #  if defined(RLIMIT_VMEM)
 #     define RLIMIT_AS RLIMIT_VMEM
@@ -75,7 +75,7 @@
 #endif
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include <paths.h>
 #endif
 
@@ -399,7 +399,7 @@ Hostinfo_GetSystemBitness(void)
    return 32;
 #else
    char buf[SYSTEM_BITNESS_MAXLEN] = { '\0', };
-#   if defined __FreeBSD__ || defined __APPLE__
+#   if defined __FreeBSD__ || defined __APPLE__ || defined __DragonFly__
    static int mib[2] = { CTL_HW, HW_MACHINE, };
    size_t len = sizeof buf;
 
@@ -934,6 +934,29 @@ HostinfoOSData(void)
       }
 
       Str_Strcpy(osName, distroShort, sizeof osName);
+   } else if (strstr(osNameFull, "DragonFly")) {
+      size_t nameLen = sizeof STR_OS_DRAGONFLY - 1;
+      size_t releaseLen = 0;
+      char *dashPtr;
+
+      /*
+       * DragonFlyBSD releases report their version as "x.y-RELEASE". We'll be
+       * naive look for the first dash, and use everything before it as the
+       * version number.
+       */
+
+      dashPtr = Str_Strchr(buf.release, '-');
+      if (dashPtr != NULL) {
+         releaseLen = dashPtr - buf.release;
+      }
+
+      if (nameLen + releaseLen + 1 > sizeof osName) {
+         Warning("%s: Error: buffer too small\n", __FUNCTION__);
+
+         return FALSE;
+      }
+
+      Str_Strcpy(osName, STR_OS_DRAGONFLY, sizeof osName);
    } else if (strstr(osNameFull, "FreeBSD")) {
       size_t nameLen = sizeof STR_OS_FREEBSD - 1;
       size_t releaseLen = 0;
@@ -1177,6 +1200,16 @@ Hostinfo_NumCPUs(void)
    }
 
    return out;
+#elif defined(__DragonFly__)
+   uint32 out;
+   size_t outSize = sizeof out;
+
+   if (sysctlbyname("hw.ncpu", &out, &outSize, NULL, 0) == -1) {
+      return -1;
+   }
+
+   return out;
+
 #elif defined(__FreeBSD__)
    uint32 out;
    size_t outSize = sizeof out;
@@ -2436,7 +2469,7 @@ Hostinfo_Daemonize(const char *path,             // IN: NUL-terminated UTF-8
 }
 
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
 /*
  *----------------------------------------------------------------------
  *
@@ -2524,10 +2557,12 @@ Bool
 Hostinfo_GetRatedCpuMhz(int32 cpuNumber,  // IN:
                         uint32 *mHz)      // OUT:
 {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 
 #  if defined(__APPLE__)
 #     define CPUMHZ_SYSCTL_NAME "hw.cpufrequency_max"
+#  elif __DragonFly__
+#     define CPUMHZ_SYSCTL_NAME "hw.clockrate"
 #  elif __FreeBSD__version >= 50011
 #     define CPUMHZ_SYSCTL_NAME "hw.clockrate"
 #  endif
@@ -2586,7 +2621,7 @@ Hostinfo_GetRatedCpuMhz(int32 cpuNumber,  // IN:
 char *
 Hostinfo_GetCpuDescription(uint32 cpuNumber)  // IN:
 {
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #  if defined(__APPLE__)
 #     define CPUDESC_SYSCTL_NAME "machdep.cpu.brand_string"
 #  else
@@ -3152,7 +3187,7 @@ HostinfoSysinfo(uint64 *totalRam,  // OUT: Total RAM in bytes
 #endif // ifndef __APPLE__
 
 
-#if defined(__linux__) || defined(__FreeBSD__) || defined(sun)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(sun) || defined(__DragonFly__)
 /*
  *-----------------------------------------------------------------------------
  *
diff --git a/open-vm-tools/lib/misc/idLinux.c b/open-vm-tools/lib/misc/idLinux.c
index a4e0907..c584e52 100644
--- a/open-vm-tools/lib/misc/idLinux.c
+++ b/open-vm-tools/lib/misc/idLinux.c
@@ -105,7 +105,7 @@ static AuthorizationRef IdAuthCreateWithFork(void);
 int
 Id_SetUid(uid_t euid)		// IN: new euid
 {
-#if defined(__FreeBSD__) || defined(sun)
+#if defined(__FreeBSD__) || defined(sun) || defined(__DragonFly__)
    return setuid(euid);
 #elif defined(linux) || defined __ANDROID__
    if (uid32) {
@@ -148,7 +148,7 @@ Id_SetGid(gid_t egid)		// IN: new egid
    Warning("XXXMACOS: implement %s\n", __func__);
 
    return -1;
-#elif defined(sun) || defined(__FreeBSD__)
+#elif defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
    return setgid(egid);
 #else
    if (uid32) {
@@ -187,7 +187,7 @@ Id_SetRESUid(uid_t uid,		// IN: new uid
 	     uid_t euid,	// IN: new effective uid
 	     uid_t suid)	// IN: new saved uid
 {
-#if (defined(__FreeBSD__) && __FreeBSD_version >= 500043)
+#if (defined(__FreeBSD__) && __FreeBSD_version >= 500043) || defined(__DragonFly__)
    return setresuid(uid, euid, suid);
 #elif defined(linux)
    if (uid32) {
@@ -231,7 +231,7 @@ Id_SetRESGid(gid_t gid,		// IN: new gid
 	     gid_t egid,	// IN: new effective gid
 	     gid_t sgid)	// IN: new saved gid
 {
-#if (defined(__FreeBSD__) && __FreeBSD_version >= 500043)
+#if (defined(__FreeBSD__) && __FreeBSD_version >= 500043) || defined(__DragonFly__)
    return setresgid(gid, egid, sgid);
 #elif defined(linux)
    if (uid32) {
@@ -279,7 +279,7 @@ Id_SetREUid(uid_t uid,		// IN: new uid
 #if defined(__APPLE__)
    Warning("XXXMACOS: implement %s\n", __func__);
    return -1;
-#elif defined(sun) || defined(__FreeBSD__)
+#elif defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
    return setreuid(uid, euid);
 #else
    if (uid32) {
@@ -320,7 +320,7 @@ int
 Id_SetREGid(gid_t gid,		// IN: new gid
 	    gid_t egid)		// IN: new effective gid
 {
-#if defined(sun) || defined(__FreeBSD__)
+#if defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
    return setregid(gid, egid);
 #else
    if (uid32) {
diff --git a/open-vm-tools/lib/misc/posixPosix.c b/open-vm-tools/lib/misc/posixPosix.c
index 2578a30..8b9fe1f 100644
--- a/open-vm-tools/lib/misc/posixPosix.c
+++ b/open-vm-tools/lib/misc/posixPosix.c
@@ -55,7 +55,7 @@
 #include <sys/param.h>
 #include <sys/mount.h>
 #include <CoreFoundation/CoreFoundation.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/param.h>
 #include <sys/mount.h>
 #elif !defined(N_PLAT_NLM)
@@ -69,13 +69,13 @@
 #endif
 #endif
 
-#if !defined(__FreeBSD__) || __FreeBSD_release >= 503001
+#if !defined(__FreeBSD__) || __FreeBSD_release >= 503001 || defined(__DragonFly__)
 #define VM_SYSTEM_HAS_GETPWNAM_R 1
 #define VM_SYSTEM_HAS_GETPWUID_R 1
 #define VM_SYSTEM_HAS_GETGRNAM_R 1
 #endif
 
-# if defined(__FreeBSD__)
+# if defined(__FreeBSD__) || defined(__DragonFly__)
 #  include <sys/syslimits.h>  // PATH_MAX
 # else
 #  include <limits.h>  // PATH_MAX
@@ -1678,7 +1678,7 @@ GetpwInternal(struct passwd *pw)  // IN:
 #endif
    free(spw.pw_shell);
    spw.pw_shell = NULL;
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
    free(spw.pw_class);
    spw.pw_class = NULL;
 #endif
@@ -1686,7 +1686,7 @@ GetpwInternal(struct passwd *pw)  // IN:
    /* Fill out structure with new values. */
    spw.pw_uid = pw->pw_uid;
    spw.pw_gid = pw->pw_gid;
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
    spw.pw_change = pw->pw_change;
    spw.pw_expire = pw->pw_expire;
    spw.pw_fields = pw->pw_fields;
@@ -1724,7 +1724,7 @@ GetpwInternal(struct passwd *pw)  // IN:
                                      STRING_ENCODING_DEFAULT)) == NULL) {
       goto exit;
    }
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
    if (pw->pw_class &&
        (spw.pw_class = Unicode_Alloc(pw->pw_class,
                                      STRING_ENCODING_DEFAULT)) == NULL) {
@@ -2018,7 +2018,7 @@ PasswdCopy(struct passwd *orig, // IN
    if (!CopyFieldIntoBuf(orig->pw_shell, &new->pw_shell, &buf, &bufLen)) {
       return NULL;
    }
-#ifdef __FreeBSD__
+#ifdef __FreeBSD__ || defined __DragonFly__
    if (!CopyFieldIntoBuf(orig->pw_class, &new->pw_class, &buf, &bufLen)) {
       return NULL;
    }
@@ -2798,7 +2798,7 @@ Posix_Getgrnam_r(ConstUnicode name,    // IN:
 
 #if !defined(sun) // {
 
-#if !defined(__APPLE__) && !defined(__FreeBSD__) // {
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__) // {
 /*
  *----------------------------------------------------------------------
  *
@@ -3216,7 +3216,7 @@ Posix_Fprintf(FILE *stream,         // IN:
 }
 
 
-#endif // } !defined(__APPLE__) && !defined(__FreeBSD)
+#endif // } !defined(__APPLE__) && !defined(__FreeBSD) && !defined(__DragonFly__)
 
 
 #else  // } !defined(sun) {
diff --git a/open-vm-tools/lib/misc/util_misc.c b/open-vm-tools/lib/misc/util_misc.c
index f8fda79..68d4509 100644
--- a/open-vm-tools/lib/misc/util_misc.c
+++ b/open-vm-tools/lib/misc/util_misc.c
@@ -47,7 +47,7 @@
 #  include <pwd.h>
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include <pthread.h>
 #endif
 
@@ -496,10 +496,10 @@ Util_GetCurrentThreadId(void)
    ASSERT(tid != (pid_t)-1);
 
    return tid;
-#elif defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
    ASSERT_ON_COMPILE(sizeof(Util_ThreadID) == sizeof(pthread_t));
 
-   return pthread_self();
+   return (Util_ThreadID) pthread_self();
 #elif defined(_WIN32)
    return GetCurrentThreadId();
 #else
diff --git a/open-vm-tools/lib/netUtil/netUtilLinux.c b/open-vm-tools/lib/netUtil/netUtilLinux.c
index 399caef..dd6ff9b 100644
--- a/open-vm-tools/lib/netUtil/netUtilLinux.c
+++ b/open-vm-tools/lib/netUtil/netUtilLinux.c
@@ -31,7 +31,7 @@
 #endif
 
 
-#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__)
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__) && !defined(__DragonFly__)
 #   error This file should not be compiled
 #endif
 
@@ -59,7 +59,7 @@
 #include <sys/ioctl.h>
 #include <net/if_arp.h>         // for ARPHRD_ETHER
 
-#if defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 #include "ifaddrs.h"
 #endif
 
@@ -150,7 +150,7 @@ invalid:
  *----------------------------------------------------------------------
  */
 
-#if !defined(__FreeBSD__) && !defined(__APPLE__) /* { */
+#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__DragonFly__) /* { */
 char *
 NetUtil_GetPrimaryIP(void)
 {
@@ -192,7 +192,7 @@ NetUtil_GetPrimaryIP(void)
    return strdup(ipstr);
 }
 
-#else /* } FreeBSD || APPLE { */
+#else /* } FreeBSD || APPLE || DragonFly { */
 
 char *
 NetUtil_GetPrimaryIP(void)
diff --git a/open-vm-tools/lib/procMgr/procMgrPosix.c b/open-vm-tools/lib/procMgr/procMgrPosix.c
index 860a582..fa750e6 100644
--- a/open-vm-tools/lib/procMgr/procMgrPosix.c
+++ b/open-vm-tools/lib/procMgr/procMgrPosix.c
@@ -31,7 +31,7 @@
 // pull in setresuid()/setresgid() if possible
 #define  _GNU_SOURCE
 #include <unistd.h>
-#if !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__) && !defined(__DragonFly__)
 #include <asm/param.h>
 #include <locale.h>
 #include <sys/stat.h>
@@ -252,7 +252,7 @@ ProcMgr_ProcList *
 ProcMgr_ListProcesses(void)
 {
    ProcMgr_ProcList *procList = NULL;
-#if !defined(__FreeBSD__) && !defined(__APPLE__)
+#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__DragonFly__)
    Bool failed = FALSE;
    DynBuf dbProcId;
    DynBuf dbProcCmd;
@@ -595,7 +595,7 @@ abort:
       ProcMgr_FreeProcList(procList);
       procList = NULL;
    }
-#endif // !defined(__FreeBSD__) && !defined(__APPLE__)
+#endif // !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__DragonFly__)
 
    return procList;
 }
diff --git a/open-vm-tools/lib/string/bsd_output_shared.c b/open-vm-tools/lib/string/bsd_output_shared.c
index 56bb804..d7b9b38 100644
--- a/open-vm-tools/lib/string/bsd_output_shared.c
+++ b/open-vm-tools/lib/string/bsd_output_shared.c
@@ -40,7 +40,7 @@
 
 //#include <sys/cdefs.h>
 
-#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/open-vm-tools/lib/string/bsd_vsnprintf.c b/open-vm-tools/lib/string/bsd_vsnprintf.c
index b621064..0fd9879 100644
--- a/open-vm-tools/lib/string/bsd_vsnprintf.c
+++ b/open-vm-tools/lib/string/bsd_vsnprintf.c
@@ -45,7 +45,7 @@
  * as bsd_vsnprintf_orig.c.
  */
 
-#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
 
 /*
  * Actual printf innards.
diff --git a/open-vm-tools/lib/string/bsd_vsnwprintf.c b/open-vm-tools/lib/string/bsd_vsnwprintf.c
index afe42c0..0b84342 100644
--- a/open-vm-tools/lib/string/bsd_vsnwprintf.c
+++ b/open-vm-tools/lib/string/bsd_vsnwprintf.c
@@ -43,7 +43,7 @@
  * as bsd_vsnwprintf_orig.c.
  */
 
-#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) \
+#if !defined(STR_NO_WIN32_LIBS) && !defined(__FreeBSD__) && !defined(__DragonFly__) \
    && !defined(__OpenBSD__) && !defined(__NetBSD__)
 
 /*
diff --git a/open-vm-tools/lib/string/str.c b/open-vm-tools/lib/string/str.c
index a00e3fd..0e15da8 100644
--- a/open-vm-tools/lib/string/str.c
+++ b/open-vm-tools/lib/string/str.c
@@ -69,7 +69,7 @@ extern int vasprintf(char **ptr, const char *f, va_list arg);
  */
 #   if !(defined(__linux__) ||                                          \
          (defined(__FreeBSD__) && (__FreeBSD_version >= 500000)) ||     \
-         defined(sun))
+         defined(sun)) || defined(__DragonFly__)
 extern int vswprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, va_list args);
 #   endif
 #endif // _WIN32
diff --git a/open-vm-tools/lib/system/systemLinux.c b/open-vm-tools/lib/system/systemLinux.c
index d1c28d9..f17d0af 100644
--- a/open-vm-tools/lib/system/systemLinux.c
+++ b/open-vm-tools/lib/system/systemLinux.c
@@ -26,7 +26,7 @@
  *
  */
 
-#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__)
+#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(sun) && !defined(__APPLE__) && !defined(__DragonFly__)
 #   error This file should not be compiled
 #endif
 
@@ -59,7 +59,7 @@
 #   include <utmpx.h>
 #endif
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include "ifaddrs.h"
 #endif
 
@@ -349,7 +349,7 @@ System_Shutdown(Bool reboot)  // IN: "reboot or shutdown" flag
       cmd = "/sbin/shutdown -r now";
 #endif
    } else {
-#if __FreeBSD__
+#if __FreeBSD__ || defined __DragonFly__
       cmd = "/sbin/shutdown -p now";
 #elif defined(sun)
       cmd = "/usr/sbin/shutdown -g 0 -i 5 -y";
diff --git a/open-vm-tools/lib/wiper/wiperPosix.c b/open-vm-tools/lib/wiper/wiperPosix.c
index 209382a..308be03 100644
--- a/open-vm-tools/lib/wiper/wiperPosix.c
+++ b/open-vm-tools/lib/wiper/wiperPosix.c
@@ -23,7 +23,7 @@
  *
  */
 
-#if !defined(__linux__) && !defined(sun) && !defined(__FreeBSD__) && !defined(__APPLE__)
+#if !defined(__linux__) && !defined(sun) && !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__DragonFly__)
 #error This file should not be compiled on this platform.
 #endif
 
@@ -31,7 +31,7 @@
 #include <sys/stat.h>
 #if defined(__linux__) || defined(sun)
 # include <sys/vfs.h>
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 # include <sys/param.h>
 # include <sys/ucred.h>
 # include <sys/mount.h>
@@ -71,7 +71,7 @@
 
 #if defined(sun) || defined(__linux__)
 # define PROCFS "proc"
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
 # define PROCFS "procfs"
 #endif
 
@@ -294,7 +294,7 @@ WiperIsDiskDevice(MNTINFO *mnt,         // IN: file system being considered
    return FALSE;
 }
 
-#elif defined(__FreeBSD__) || defined(__APPLE__) /* } FreeBSD { */
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) /* } FreeBSD { */
 
 static Bool
 WiperIsDiskDevice(MNTINFO *mnt,         // IN: file system being considered
diff --git a/open-vm-tools/rpctool/rpctool.c b/open-vm-tools/rpctool/rpctool.c
index 1a1ee6d..a87e643 100644
--- a/open-vm-tools/rpctool/rpctool.c
+++ b/open-vm-tools/rpctool/rpctool.c
@@ -151,7 +151,7 @@ main(int argc, char *argv[])
       return 1;
    }
 #else
-#ifdef __FreeBSD__
+#if defined (__FreeBSD__) || defined(__DragonFly__)
 #  define ERROR_SIGNAL SIGBUS
 #else
 #  define ERROR_SIGNAL SIGSEGV
diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
index dc13009..76c85ef 100644
--- a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
+++ b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c
@@ -39,7 +39,7 @@
 #include "util.h"
 #include "escape.h"
 #include "su.h"
-#if defined(linux) || defined(sun) || defined(__FreeBSD__)
+#if defined(linux) || defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include "vmblock_user.h"
 #include "mntinfo.h"
 #endif
@@ -303,7 +303,7 @@ DnD_UriIsNonFileSchemes(const char *uri)
 
 
 /* We need to make this suck less. */
-#if defined(linux) || defined(sun) || defined(__FreeBSD__)
+#if defined(linux) || defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__)
 
 /*
  *----------------------------------------------------------------------------
@@ -730,7 +730,7 @@ DnD_CompleteBlockInitialization(int fd,                     // IN
    return TRUE;
 }
 
-#endif /* linux || sun || FreeBSD */
+#endif /* linux || sun || FreeBSD || DragonFly */
 
 
 /*
diff --git a/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h b/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h
index 1422194..1797552 100644
--- a/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h
+++ b/open-vm-tools/services/plugins/guestInfo/getlib/getlibInt.h
@@ -29,7 +29,7 @@
 
 #include "guestInfoInt.h"
 
-#if defined __FreeBSD__ || defined __sun__ || defined __APPLE__
+#if defined __FreeBSD__ || defined __sun__ || defined __APPLE__ || defined __DragonFly__
 #   include <sys/socket.h>      // struct sockaddr
 #endif
 
diff --git a/open-vm-tools/services/plugins/timeSync/Makefile.am b/open-vm-tools/services/plugins/timeSync/Makefile.am
index 7d7ce65..deaf825 100644
--- a/open-vm-tools/services/plugins/timeSync/Makefile.am
+++ b/open-vm-tools/services/plugins/timeSync/Makefile.am
@@ -39,6 +39,10 @@ if FREEBSD
 libtimeSync_la_SOURCES += slewAdjtime.c
 libtimeSync_la_SOURCES += pllNone.c
 endif
+if DRAGONFLY
+libtimeSync_la_SOURCES += slewAdjtime.c
+libtimeSync_la_SOURCES += pllNone.c
+endif
 if LINUX
 libtimeSync_la_SOURCES += slewLinux.c
 libtimeSync_la_SOURCES += pllLinux.c
diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c
index 837dbb9..3f2c0da 100644
--- a/open-vm-tools/services/plugins/vix/vixTools.c
+++ b/open-vm-tools/services/plugins/vix/vixTools.c
@@ -103,7 +103,7 @@
 #endif
 
 /* Only Windows and Linux use impersonation functions. */
-#if !defined(__FreeBSD__) && !defined(sun)
+#if !defined(__FreeBSD__) && !defined(sun) && !defined(__DragonFly__)
 #include "impersonate.h"
 #endif
 
@@ -283,7 +283,7 @@ typedef struct VixToolsEnvironmentTableIterator {
  */
 static HashTable *userEnvironmentTable = NULL;
 #endif
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
 static HgfsServerMgrData gVixHgfsBkdrConn;
 #endif
 
@@ -558,7 +558,7 @@ VixTools_Initialize(Bool thisProcessRunsAsRootParam,
    VixToolsInitSspiSessionList(VIX_TOOLS_MAX_SSPI_SESSIONS);
    VixToolsInitTicketedSessionList(VIX_TOOLS_MAX_TICKETED_SESSIONS);
 #endif
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
    /* Register a straight through connection with the Hgfs server. */
    HgfsServerManager_DataInit(&gVixHgfsBkdrConn,
                               VIX_BACKDOORCOMMAND_COMMAND,
@@ -594,7 +594,7 @@ VixTools_Initialize(Bool thisProcessRunsAsRootParam,
 void
 VixTools_Uninitialize(void) // IN
 {
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
    HgfsServerManager_Unregister(&gVixHgfsBkdrConn);
 #endif
 }
@@ -1948,7 +1948,7 @@ VixTools_GetToolsPropertiesImpl(GKeyFile *confDictRef,            // IN
    VixPropertyListImpl propList;
    char *serializedBuffer = NULL;
    size_t serializedBufferLength = 0;
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
    char *guestName;
    int osFamily;
    char *packageList = NULL;
@@ -2187,7 +2187,7 @@ abort:
 abort:
    VixPropertyList_RemoveAllWithoutHandles(&propList);
    free(serializedBuffer);
-#endif // __FreeBSD__
+#endif // __FreeBSD__ || __DragonFly__
    
    return err;
 } // VixTools_GetToolsPropertiesImpl
@@ -3792,7 +3792,7 @@ VixToolsMoveObject(VixCommandRequestHeader *requestMsg)        // IN
     * Be careful. Renaming a file to itself can cause it to be deleted.
     * This should be a no-op anyway.
     */
-#if !defined(sun) && !defined(__FreeBSD__)
+#if !defined(sun) && !defined(__FreeBSD__) && !defined(__DragonFly__)
    if (File_IsSameFile(srcFilePathName, destFilePathName)) {
       err = VIX_OK;
       goto abort;
@@ -6762,7 +6762,7 @@ VixToolsImpersonateUserImplEx(char const *credentialTypeStr,         // IN
    *userToken = NULL;
 
 ///////////////////////////////////////////////////////////////////////
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
    err = VIX_E_NOT_SUPPORTED;
 ///////////////////////////////////////////////////////////////////////
 #elif defined(_WIN32) || defined(linux) || defined(sun)
@@ -6972,7 +6972,7 @@ VixToolsLogoutUser(void *userToken)    // IN
       return;
    }
 
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
    if (NULL != userToken) {
       AuthToken authToken = (AuthToken) userToken;
       Auth_CloseToken(authToken);
@@ -7441,7 +7441,7 @@ VixToolsProcessHgfsPacket(VixCommandHgfsSendPacket *requestMsg,   // IN
 
    hgfsReplyPacketSize = sizeof hgfsReplyPacket;
 
-#if !defined(__FreeBSD__)
+#if !defined(__FreeBSD__) || !defined(__DragonFly__)
    /*
     * Impersonation was okay, so let's give our packet to
     * the HGFS server and forward the reply packet back.
diff --git a/open-vm-tools/services/plugins/vix/vixToolsEnvVars.c b/open-vm-tools/services/plugins/vix/vixToolsEnvVars.c
index 22452e5..32cd26f 100644
--- a/open-vm-tools/services/plugins/vix/vixToolsEnvVars.c
+++ b/open-vm-tools/services/plugins/vix/vixToolsEnvVars.c
@@ -131,7 +131,7 @@ VixToolsNewEnvIterator(void *userToken,                  // IN
    }
 #elif defined(__APPLE__)
    it->environ = *_NSGetEnviron();
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
    /*
     * Looking at /build/toolchain/bsd32/freebsd-6.3/usr/include/stand.h,
     * environ is a pointer to a doubly linked list of structs. I guess they
