pkgsrc/sysutils/open-vm-tools/patches/patch-bf
ryoon b62fef397b Update to 10.2.0
* Use x11/gtkmm3

Changelog:
Compatibility
  * open-vm-tools 10.2.0 is compatible with all supported versions
    of VMware vSphere ESXi 5.5 and later, VMware Workstation 14.0 and
    VMware Fusion 10.0. See VMware Compatibility Guide for more information.

  * Starting with VMware Tools version 10.2.0, Perl script based VMware
    Tools installation for FreeBSD has been discontinued. Going forward,
    FreeBSD systems are supported only through the open-vm-tools packages
    directly available from FreeBSD package repositories. FreeBSD packages
    for open-vm-tools 10.1.0 and later are available from FreeBSD package
    repositories.

Resolved Issues
  * Summary page of the VM does not list the IP address of the VMs in
    the right order

  * Guest authentication fails with a SystemError fault when the requested
    password is expired

  * The free space reported in vim.vm.GuestInfo.DiskInfo for a Linux guest
    does not match with df command in the guest

  * VMware user process might not restart after upgrades of open-vm-tools
2018-01-01 06:56:01 +00:00

199 lines
6.2 KiB
Text

$NetBSD: patch-bf,v 1.7 2018/01/01 06:56:01 ryoon Exp $
--- lib/procMgr/procMgrPosix.c.orig 2017-12-15 19:09:51.000000000 +0000
+++ lib/procMgr/procMgrPosix.c
@@ -27,7 +27,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(__NetBSD__)
#include <asm/param.h>
#endif
#if !defined(sun) && !defined(__APPLE__)
@@ -53,7 +53,7 @@
// Pull in PAGE_SIZE/PAGE_SHIFT defines ahead of vm_basic_defs.h
# include <sys/user.h>
#endif
-#if defined (__FreeBSD__)
+#if defined (__FreeBSD__) || defined(__NetBSD__)
#include <kvm.h>
#include <limits.h>
#include <paths.h>
@@ -136,7 +136,7 @@ Bool ProcMgr_PromoteEffectiveToReal(void
#ifdef sun
#define BASH_PATH "/usr/bin/bash"
#else
-#define BASH_PATH "/bin/bash"
+#define BASH_PATH "@PREFIX@/bin/bash"
#endif
@@ -614,7 +614,7 @@ abort:
*----------------------------------------------------------------------
*/
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
ProcMgrProcInfoArray *
ProcMgr_ListProcesses(void)
{
@@ -622,7 +622,11 @@ ProcMgr_ListProcesses(void)
ProcMgrProcInfo procInfo;
Bool failed = TRUE;
static kvm_t *kd;
+#if defined(__NetBSD__)
+ struct kinfo_proc2 *kp;
+#else
struct kinfo_proc *kp;
+#endif
char errbuf[_POSIX2_LINE_MAX];
int i;
int nentries=-1;
@@ -645,7 +649,12 @@ ProcMgr_ListProcesses(void)
/*
* Get the list of process info structs
*/
+#if defined(__NetBSD__)
+ int elemsize = sizeof(struct kinfo_proc2);
+ kp = kvm_getproc2(kd, KERN_PROC_ALL, flag, elemsize, &nentries);
+#else
kp = kvm_getprocs(kd, KERN_PROC_PROC, flag, &nentries);
+#endif
if (kp == NULL || nentries <= 0) {
Warning("%s: failed to get proc infos with error: %s\n",
__FUNCTION__, kvm_geterr(kd));
@@ -673,14 +682,26 @@ ProcMgr_ListProcesses(void)
/*
* Store the pid of the process.
*/
+#if defined(__NetBSD__)
+ procInfo.procId = kp->p_pid;
+#else
procInfo.procId = kp->ki_pid;
+#endif
/*
* Store the owner of the process.
*/
+#if defined(__NetBSD__)
+ pwd = getpwuid(kp->p_uid);
+#else
pwd = getpwuid(kp->ki_uid);
+#endif
procInfo.procOwner = (NULL == pwd)
+#if defined(__NetBSD__)
+ ? Str_SafeAsprintf(NULL, "%d", (int) kp->p_uid)
+#else
? Str_SafeAsprintf(NULL, "%d", (int) kp->ki_uid)
+#endif
: Unicode_Alloc(pwd->pw_name, STRING_ENCODING_DEFAULT);
/*
@@ -688,15 +709,24 @@ ProcMgr_ListProcesses(void)
* maximum allowed size, then we can save it right now. Else we shall
* need to try and parse it from the entire command line.
*/
+#if defined(__NetBSD__)
+ if (strlen(kp->p_comm) + 1 < sizeof kp->p_comm) {
+ procInfo.procCmdName = Unicode_Alloc(kp->p_comm, STRING_ENCODING_DEFAULT);
+#else
if (strlen(kp->ki_comm) + 1 < sizeof kp->ki_comm) {
procInfo.procCmdName = Unicode_Alloc(kp->ki_comm, STRING_ENCODING_DEFAULT);
+#endif
cmdNameLookup = FALSE;
}
/*
* Store the command line string of the process.
*/
+#if defined(__NetBSD__)
+ cmdLineTemp = kvm_getargv2(kd, kp, 0);
+#else
cmdLineTemp = kvm_getargv(kd, kp, 0);
+#endif
if (cmdLineTemp != NULL) {
/*
* Flatten the argument list to get cmd & all params.
@@ -752,9 +782,15 @@ ProcMgr_ListProcesses(void)
procInfo.procCmdLine = DynBuf_Detach(&dbuf);
DynBuf_Destroy(&dbuf);
} else {
+#if defined(__NetBSD__)
+ procInfo.procCmdLine = Unicode_Alloc(kp->p_comm, STRING_ENCODING_DEFAULT);
+ if (cmdNameLookup) {
+ procInfo.procCmdName = Unicode_Alloc(kp->p_comm, STRING_ENCODING_DEFAULT);
+#else
procInfo.procCmdLine = Unicode_Alloc(kp->ki_comm, STRING_ENCODING_DEFAULT);
if (cmdNameLookup) {
procInfo.procCmdName = Unicode_Alloc(kp->ki_comm, STRING_ENCODING_DEFAULT);
+#endif
cmdNameLookup = FALSE;
}
}
@@ -762,7 +798,11 @@ ProcMgr_ListProcesses(void)
/*
* Store the start time of the process
*/
+#if defined(__NetBSD__)
+ procInfo.procStartTime = kp->p_rtime_sec;
+#else
procInfo.procStartTime = kp->ki_start.tv_sec;
+#endif
/*
* Store the process info pointer into a list buffer.
@@ -792,7 +832,7 @@ abort:
return procList;
}
-#endif // defined(__FreeBSD__)
+#endif // defined(__NetBSD__)
#if defined(__APPLE__)
@@ -2152,7 +2192,7 @@ ProcMgr_Free(ProcMgr_AsyncProc *asyncPro
free(asyncProc);
}
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
/*
*----------------------------------------------------------------------
@@ -2234,7 +2274,7 @@ ProcMgr_ImpersonateUserStart(const char
// first change group
#if defined(USERWORLD)
ret = Id_SetREGid(ppw->pw_gid, ppw->pw_gid);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
ret = setegid(ppw->pw_gid);
#else
ret = setresgid(ppw->pw_gid, ppw->pw_gid, root_gid);
@@ -2253,7 +2293,7 @@ ProcMgr_ImpersonateUserStart(const char
// now user
#if defined(USERWORLD)
ret = Id_SetREUid(ppw->pw_uid, ppw->pw_uid);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
ret = seteuid(ppw->pw_uid);
#else
ret = setresuid(ppw->pw_uid, ppw->pw_uid, 0);
@@ -2315,7 +2355,7 @@ ProcMgr_ImpersonateUserStop(void)
// first change back user
#if defined(USERWORLD)
ret = Id_SetREUid(ppw->pw_uid, ppw->pw_uid);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
ret = seteuid(ppw->pw_uid);
#else
ret = setresuid(ppw->pw_uid, ppw->pw_uid, 0);
@@ -2328,7 +2368,7 @@ ProcMgr_ImpersonateUserStop(void)
// now group
#if defined(USERWORLD)
ret = Id_SetREGid(ppw->pw_gid, ppw->pw_gid);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__NetBSD__)
ret = setegid(ppw->pw_gid);
#else
ret = setresgid(ppw->pw_gid, ppw->pw_gid, ppw->pw_gid);