Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions open-vm-tools/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ case "$host_os" in
[solaris*])
os="solaris"
;;
[netbsd*])
os="netbsd"
;;
[*])
AC_MSG_WARN([This is an untested and unsupported Operating System. Proceed at your own peril.])
;;
Expand Down Expand Up @@ -615,6 +618,18 @@ if test "$with_fuse" = "fuse" ||
AC_DEFINE([FUSE_USE_VERSION], 29, [FUSE API version to use.])],
[have_fuse=no])

if test "$have_fuse" = "no" -a "$os" = "netbsd"; then
AC_CHECK_LIB(
[refuse],
[fuse_loop],
[have_fuse=yes;
FUSE_CPPFLAGS="-D_NETBSD_SOURCE -D_KERNTYPES";
FUSE_LIBS=-lrefuse;
AC_DEFINE([HAVE_FUSE], 1, [Define to 1 if using FUSE.])
AC_DEFINE([FUSE_USE_VERSION], 29, [FUSE API version to use.])],
[have_fuse=no])
fi

if test "$have_fuse" = "no"; then
if test "$with_fuse" = "auto" || test "$with_fuse" = "yes"; then
AC_MSG_NOTICE([Fuse is missing, vmblock-fuse/vmhgfs-fuse will be disabled.])
Expand Down Expand Up @@ -1689,6 +1704,8 @@ fi
AM_CONDITIONAL(LINUX, test "$os" = "linux")
AM_CONDITIONAL(SOLARIS, test "$os" = "solaris")
AM_CONDITIONAL(FREEBSD, test "$os" = "freebsd" -o "$os" = "kfreebsd-gnu")
AM_CONDITIONAL(NETBSD, test "$os" = "netbsd")
AM_CONDITIONAL(BSD, test "$os" = "freebsd" -o "$os" = "kfreebsd-gnu" -o "$os" = "netbsd")
AM_CONDITIONAL(FREEBSD_CUSTOM_SYSDIR,
test \( "$os" = "freebsd" -o "$os" = "kfreebsd-gnu" \) -a -n "$SYSDIR")
AM_CONDITIONAL(ARCH_X32, test "$arch" = "x32")
Expand Down
3 changes: 2 additions & 1 deletion open-vm-tools/lib/dynxdr/dynxdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ 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) || defined(USE_TIRPC)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(sun) || defined(USE_TIRPC)
# define DYNXDR_GETPOS_CONST
#else
# define DYNXDR_GETPOS_CONST const
Expand Down
4 changes: 4 additions & 0 deletions open-vm-tools/lib/dynxdr/xdrutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ XdrUtil_Deserialize(const void *data, // IN
ASSERT(dest != NULL);

xdrmem_create(&xdrs, (char *) data, dataLen, XDR_DECODE);
#if defined(__NetBSD__)
ret = (Bool) proc(&xdrs, dest);
#else
ret = (Bool) proc(&xdrs, dest, 0);
#endif
xdr_destroy(&xdrs);

if (!ret) {
Expand Down
10 changes: 5 additions & 5 deletions open-vm-tools/lib/file/fileIOPosix.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#include <dlfcn.h>
#include <sys/xattr.h>
#else
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#else
Expand Down Expand Up @@ -1493,7 +1493,7 @@ FileIO_Writev(FileIODescriptor *fd, // IN:


#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||\
defined(__sun__)
defined(__sun__) || defined(__NetBSD__)

/*
*----------------------------------------------------------------------
Expand Down Expand Up @@ -1679,7 +1679,7 @@ FileIOPwritevCoalesced(
}

#endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||
defined(__sun__) */
defined(__sun__) || defined(__NetBSD__) */


#if defined(__linux__) && !defined(__ANDROID__)
Expand Down Expand Up @@ -1952,7 +1952,7 @@ FileIOPwritevInternal(


#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||\
defined(__sun__)
defined(__sun__) || defined(__NetBSD__)

/*
*----------------------------------------------------------------------
Expand Down Expand Up @@ -2046,7 +2046,7 @@ FileIO_Pwritev(FileIODescriptor *fd, // IN: File descriptor
}

#endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) ||
defined(__sun__) */
defined(__sun__) || defined(__NetBSD__) */


/*
Expand Down
26 changes: 17 additions & 9 deletions open-vm-tools/lib/file/filePosix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(__NetBSD__)
# include <sys/param.h>
# include <sys/mount.h>
#else
Expand Down Expand Up @@ -57,6 +57,10 @@
#include <TargetConditionals.h>
#endif

#if defined(__NetBSD__)
#define statfs statvfs
#endif

#include "vmware.h"
#include "posix.h"
#include "codeset.h"
Expand Down Expand Up @@ -115,9 +119,9 @@ struct WalkDirContextImpl {
#define FS_VSAND_ON_ESX "vsanD"
#define FS_VSAN_URI_PREFIX "vsan:"

#if defined __ANDROID__
#if defined __ANDROID__ || defined __NetBSD__
/*
* Android doesn't support setmntent(), endmntent() or MOUNTED.
* Android and NetBSD doesn't support setmntent(), endmntent() or MOUNTED.
*/
#define NO_SETMNTENT
#define NO_ENDMNTENT
Expand Down Expand Up @@ -370,7 +374,7 @@ FileAttributes(const char *pathName, // IN:
*----------------------------------------------------------------------
*/

#if !defined(__FreeBSD__) && !defined(sun)
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(sun)
Bool
File_IsRemote(const char *pathName) // IN: Path name
{
Expand Down Expand Up @@ -409,7 +413,7 @@ File_IsRemote(const char *pathName) // IN: Path name
#endif
}
}
#endif /* !FreeBSD && !sun */
#endif /* !FreeBSD && !NetBSD && !sun */


/*
Expand Down Expand Up @@ -581,8 +585,8 @@ File_StripFwdSlashes(const char *pathName) // IN:
* directory and so on. If the path is NULL or "", this routine
* returns the current working directory.
*
* On FreeBSD and Sun platforms, this routine will only work if
* the path exists, or when we are about to create a child in an
* On BSD and Sun platforms, this routine will only work if the
* path exists, or when we are about to create a child in an
* existing parent directory. This is because on these platforms,
* we cannot rely on finding existing ancestor and such because
* those functions are not compiled.
Expand Down Expand Up @@ -626,15 +630,15 @@ File_FullPath(const char *pathName) // IN:
if (ret == NULL) {
char *dir;
char *file;
#if defined(__FreeBSD__) || defined(sun)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sun)
char *realDir;
#else
char *ancestorPath;
char *ancestorRealPath;
#endif

File_GetPathName(path, &dir, &file);
#if defined(__FreeBSD__) || defined(sun)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(sun)
realDir = Posix_RealPath(dir);
if (realDir == NULL) {
realDir = File_StripFwdSlashes(dir);
Expand Down Expand Up @@ -2186,6 +2190,10 @@ File_IsSameFile(const char *path1, // IN:
if ((stfs1.f_flags & MNT_LOCAL) && (stfs2.f_flags & MNT_LOCAL)) {
return TRUE;
}
#elif defined(__NetBSD__)
if ((stfs1.f_flag & MNT_LOCAL) && (stfs2.f_flag & MNT_LOCAL)) {
return TRUE;
}
#else
if ((stfs1.f_type != NFS_SUPER_MAGIC) &&
(stfs2.f_type != NFS_SUPER_MAGIC)) {
Expand Down
5 changes: 3 additions & 2 deletions open-vm-tools/lib/hgfsHelper/hgfsHelperPosix.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
*
*/

#if !defined __linux__ && !defined __FreeBSD__ && !defined sun && !defined __APPLE__
#if !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ && \
!defined sun && !defined __APPLE__
# error This file should not be compiled
#endif

Expand Down Expand Up @@ -65,7 +66,7 @@
Bool
HgfsHlpr_QuerySharesDefaultRootPath(char **hgfsRootPath)
{
#if defined __FreeBSD__
#if defined __FreeBSD__ || defined __NetBSD__
return FALSE;
#else
ASSERT(hgfsRootPath != NULL);
Expand Down
3 changes: 2 additions & 1 deletion open-vm-tools/lib/hgfsUri/hgfsUriPosix.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
* x-vmware-share:// style URIs
*/

#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__
#if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \
!defined __NetBSD__
# error This file should not be compiled
#endif

Expand Down
1 change: 1 addition & 0 deletions open-vm-tools/lib/include/codeset.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extern "C" {
*/

#if defined(__FreeBSD__) || \
defined(__NetBSD__) || \
defined(VMX86_SERVER) || \
defined(__APPLE__) || \
defined __ANDROID__
Expand Down
3 changes: 3 additions & 0 deletions open-vm-tools/lib/include/guest_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ Bool Gos_InSetArray(uint32 gos, const uint32 *set);
/* FreeBSD */
#define STR_OS_FREEBSD "freeBSD"

/* NetBSD */
#define STR_OS_NETBSD "netbsd"

/* Solaris */
#define STR_OS_SOLARIS "solaris"

Expand Down
4 changes: 3 additions & 1 deletion open-vm-tools/lib/include/hgfsUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
!defined __timespec_defined && \
!defined sun && \
!defined __FreeBSD__ && \
!defined __NetBSD__ && \
!__APPLE__ && \
!defined _WIN32
struct timespec {
Expand All @@ -73,7 +74,8 @@ 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 __NetBSD__ || \
defined __APPLE__
# include <sys/errno.h>
# endif
# else
Expand Down
3 changes: 2 additions & 1 deletion open-vm-tools/lib/include/iovector.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ extern "C" {
/*
* Ugly definition of struct iovec.
*/
#if defined(__linux__) || defined(sun) || defined(__APPLE__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(sun) || defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/uio.h> // for struct iovec
#else

Expand Down
13 changes: 10 additions & 3 deletions open-vm-tools/lib/include/mntinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# include <limits.h>
#elif defined(__linux__)
# include <mntent.h>
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/mount.h>
#endif
#include "posix.h"
Expand Down Expand Up @@ -106,7 +106,10 @@
# 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(__NetBSD__) || defined(__APPLE__)
#if defined(__NetBSD__)
#define statfs statvfs
#endif
struct mntHandle {
struct statfs *mountPoints; // array of mountpoints per getmntinfo(3)
int numMountPoints; // number of elements in mntArray
Expand Down Expand Up @@ -155,7 +158,11 @@ struct mntHandle {
# define MNTINFO_NAME(mnt) mnt->f_mntfromname
# define MNTINFO_FSTYPE(mnt) mnt->f_fstypename
# define MNTINFO_MNTPT(mnt) mnt->f_mntonname
# define MNTINFO_MNT_IS_RO(mnt) ((mnt)->f_flags & MNT_RDONLY)
# if defined __NetBSD__
# define MNTINFO_MNT_IS_RO(mnt) ((mnt)->f_flag & MNT_RDONLY)
# else
# define MNTINFO_MNT_IS_RO(mnt) ((mnt)->f_flags & MNT_RDONLY)
# endif
#else
# error "Define mount information macros for your OS type"
#endif
Expand Down
8 changes: 4 additions & 4 deletions open-vm-tools/lib/include/posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ char *Posix_MkTemp(const char *pathName);
* Make them NULL wrappers for all other platforms.
*/
#define Posix_GetHostName gethostname
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__NetBSD__)
#define Posix_GetHostByName gethostbyname
#endif
#define Posix_GetAddrInfo getaddrinfo
Expand Down Expand Up @@ -209,7 +209,7 @@ struct mntent *Posix_Getmntent_r(FILE *fp, struct mntent *m,
int Posix_Getmntent(FILE *fp, struct mnttab *mp);

#endif // !defined(sun)
#if !defined(__APPLE__)
#if !defined(__APPLE__) && !defined(__NetBSD__)


/*
Expand Down Expand Up @@ -280,7 +280,7 @@ Posix_GetHostByName(const char *name) // IN
/* There has been an error */
return NULL;
}
#endif // !define(__APPLE__)
#endif // !define(__APPLE__) && !defined(__NetBSD__)


/*
Expand All @@ -303,7 +303,7 @@ Posix_GetHostByName(const char *name) // IN
static INLINE void
Posix_FreeHostent(struct hostent *he)
{
#if !defined(__APPLE__)
#if !defined(__APPLE__) && !defined(__NetBSD__)
char **p;

if (he) {
Expand Down
2 changes: 1 addition & 1 deletion open-vm-tools/lib/include/procMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct ProcMgr_AsyncProc ProcMgr_AsyncProc;
typedef struct ProcMgrProcInfo {
ProcMgr_Pid procId;
char *procCmdName; // UTF-8
#if defined(__linux__) || defined(_WIN32)
#if defined(__linux__) || defined(__NetBSD__) || defined(_WIN32)
char *procCmdAbsPath; // UTF-8
#endif
char *procCmdLine; // UTF-8
Expand Down
32 changes: 32 additions & 0 deletions open-vm-tools/lib/include/sigPosixRegs.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,38 @@ extern "C" {
#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.mc_esp)
#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.mc_eip)
#endif
#elif defined (__NetBSD__)
#ifdef __x86_64__
#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RAX])
#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RBX])
#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RCX])
#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RDX])
#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RDI])
#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RSI])
#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RBP])
#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RSP])
#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_RIP])
#define SC_R8(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R8])
#define SC_R9(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R9])
#define SC_R10(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R10])
#define SC_R11(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R11])
#define SC_R12(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R12])
#define SC_R13(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R13])
#define SC_R14(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R14])
#define SC_R15(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_R15])
#elif defined(__aarch64__)
#define SC_X(uc,n) ((unsigned long) (uc)->uc_mcontext.__gregs[n])
#else
#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EAX])
#define SC_EBX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EBX])
#define SC_ECX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_ECX])
#define SC_EDX(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EDX])
#define SC_EDI(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EDI])
#define SC_ESI(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_ESI])
#define SC_EBP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EBP])
#define SC_ESP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_ESP])
#define SC_EIP(uc) ((unsigned long) (uc)->uc_mcontext.__gregs[_REG_EIP])
#endif
#elif defined (sun)
#ifdef __x86_64__
#define SC_EAX(uc) ((unsigned long) (uc)->uc_mcontext.gregs[REG_RAX])
Expand Down
3 changes: 2 additions & 1 deletion open-vm-tools/lib/include/su.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Bool Id_AuthCheck(char const *right,
char const *localizedDescription,
Bool showDialogIfNeeded);

#elif (defined(__linux__) || defined(sun) || defined(__FreeBSD__))
#elif (defined(__linux__) || defined(sun) || defined(__FreeBSD__) || \
defined(__NetBSD__))

#include <sys/types.h>
#include <unistd.h>
Expand Down
Loading