From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:45 +0000 (-0700) Subject: Remove logic for unsupported versions of macOS. X-Git-Tag: stable-10.2.0~151 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84cf06912d4060ce29fd7a3b765eb34917dd1501;p=thirdparty%2Fopen-vm-tools.git Remove logic for unsupported versions of macOS. We no longer support macOS 10.4-10.7. Remove the old logic that supported these versions. --- diff --git a/open-vm-tools/lib/auth/authPosix.c b/open-vm-tools/lib/auth/authPosix.c index 399f78a00..f47bca24e 100644 --- a/open-vm-tools/lib/auth/authPosix.c +++ b/open-vm-tools/lib/auth/authPosix.c @@ -36,16 +36,7 @@ # include "file.h" # include "config.h" # include "localconfig.h" -# if defined __APPLE__ -# include -# if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 -# include -# else -# include -# endif -# else -# include -# endif +# include # include #endif diff --git a/open-vm-tools/lib/file/fileIOPosix.c b/open-vm-tools/lib/file/fileIOPosix.c index 282cdd6b1..47e11381e 100644 --- a/open-vm-tools/lib/file/fileIOPosix.c +++ b/open-vm-tools/lib/file/fileIOPosix.c @@ -53,7 +53,7 @@ #include "su.h" #if defined(__APPLE__) -#include "sysSocket.h" // Don't move this: it fixes a system header. +#include #include #include #include @@ -99,18 +99,7 @@ #if defined(__APPLE__) #include - -/* - * F_NODIRECT was added in Mac OS 10.7.0 "Lion". We test at runtime for the - * right version before using it, but we also need to get the definition. - */ - #include - -#ifndef F_NODIRECT -#define F_NODIRECT 62 -#endif - #endif /* @@ -969,19 +958,14 @@ FileIOCreateRetry(FileIODescriptor *file, // OUT: } if (!(access & FILEIO_OPEN_SYNC)) { - /* - * F_NODIRECT was added in Mac OS 10.7.0 "Lion". - */ - if (Hostinfo_OSVersion(0) >= HOSTINFO_OS_VERSION_MACOS_10_7) { - error = fcntl(fd, F_NODIRECT, 1); - if (error == -1) { - ret = FileIOErrno2Result(errno); - if (ret == FILEIO_ERROR) { - Log(LGPFX "fcntl error on %s: %s\n", pathName, - Err_Errno2String(errno)); - } - goto error; + error = fcntl(fd, F_NODIRECT, 1); + if (error == -1) { + ret = FileIOErrno2Result(errno); + if (ret == FILEIO_ERROR) { + Log(LGPFX "fcntl error on %s: %s\n", pathName, + Err_Errno2String(errno)); } + goto error; } } } diff --git a/open-vm-tools/lib/include/vm_basic_defs.h b/open-vm-tools/lib/include/vm_basic_defs.h index 4e5aabc79..faca55747 100644 --- a/open-vm-tools/lib/include/vm_basic_defs.h +++ b/open-vm-tools/lib/include/vm_basic_defs.h @@ -536,19 +536,8 @@ typedef int pid_t; #elif defined(__APPLE__) && defined(KERNEL) -#include "availabilityMacOS.h" - -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 -// The Mac OS 10.5 kernel SDK defines va_copy in stdarg.h. +// The macOS kernel SDK defines va_copy in stdarg.h. #include -#else -/* - * The Mac OS 10.4 kernel SDK needs va_copy. Based on inspection of - * stdarg.h from the MacOSX10.4u.sdk kernel framework, this should - * work. - */ -#define va_copy(dest, src) ((dest) = (src)) -#endif // MAC_OS_X_VERSION_MIN_REQUIRED #elif defined(__GNUC__) && (__GNUC__ < 3) diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index ca161e23e..d1c36d613 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -59,9 +59,6 @@ #include #include #include -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 // Must run on Mac OS versions < 10.7 -# include -#endif #elif defined(__FreeBSD__) #if !defined(RLIMIT_AS) # if defined(RLIMIT_VMEM) @@ -2554,7 +2551,7 @@ Hostinfo_Execute(const char *path, // IN: * * 3) In Mac OS 10.7, Apple cleaned their mess and solved all the above * problems by introducing a new mach_zone_info() Mach call. So this is what - * we use now, when available. Was bug 816610. + * we use now. Was bug 816610. * * 4) In Mac OS 10.8, Apple appears to have modified mach_zone_info() to always * return KERN_INVALID_HOST(!) when the calling process (not the calling @@ -2562,135 +2559,6 @@ Hostinfo_Execute(const char *path, // IN: */ -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 // Must run on Mac OS versions < 10.7 -/* - *----------------------------------------------------------------------------- - * - * HostinfoGetKernelZoneElemSizeZprint -- - * - * Retrieve the size of the elements in a named kernel zone, by invoking - * zprint. - * - * Results: - * On success: the size (in bytes) > 0. - * On failure: 0. - * - * Side effects: - * None - * - *----------------------------------------------------------------------------- - */ - -static size_t -HostinfoGetKernelZoneElemSizeZprint(char const *name) // IN: Kernel zone name -{ - size_t retval = 0; - struct { - size_t retval; - } volatile *shared; - pid_t child; - pid_t pid; - - /* - * popen(3) incorrectly executes the shell with the identity of the calling - * process, ignoring a potential per-thread identity. And starting with - * Mac OS 10.6 it is even worse: if there is a per-thread identity, - * popen(3) removes it! - * - * So we run this code in a separate process which runs with the same - * identity as the current thread. - */ - - shared = mmap(NULL, sizeof *shared, PROT_READ | PROT_WRITE, - MAP_ANON | MAP_SHARED, -1, 0); - - if (shared == (void *)-1) { - Warning("%s: mmap error %d.\n", __FUNCTION__, errno); - - return retval; - } - - // In case the child is terminated before it can set it. - shared->retval = retval; - - child = fork(); - if (child == (pid_t)-1) { - Warning("%s: fork error %d.\n", __FUNCTION__, errno); - munmap((void *)shared, sizeof *shared); - - return retval; - } - - // This executes only in the child process. - if (!child) { - size_t nameLen; - FILE *stream; - Bool parsingProperties = FALSE; - - ASSERT(name); - - nameLen = strlen(name); - ASSERT(nameLen && *name != '\t'); - - stream = popen("/usr/bin/zprint -C", "r"); - if (!stream) { - Warning("%s: popen error %d.\n", __FUNCTION__, errno); - exit(EXIT_SUCCESS); - } - - for (;;) { - char *line; - size_t lineLen; - - if (StdIO_ReadNextLine(stream, &line, 0, - &lineLen) != StdIO_Success) { - break; - } - - if (parsingProperties) { - if ( // Not a property line anymore. Property not found. - lineLen < 1 || memcmp(line, "\t", 1) - // Property found. - || sscanf(line, " elem_size: %"FMTSZ"u bytes", - &shared->retval) == 1) { - free(line); - break; - } - } else if (!(lineLen < nameLen + 6 || - memcmp(line, name, nameLen) || - memcmp(line + nameLen, " zone:", 6))) { - // Zone found. - parsingProperties = TRUE; - } - - free(line); - } - - pclose(stream); - exit(EXIT_SUCCESS); - } - - /* - * This executes only in the parent process. - * Wait for the child to terminate, and return its retval. - */ - - do { - int status; - - pid = waitpid(child, &status, 0); - } while ((pid == -1) && (errno == EINTR)); - - VERIFY(pid == child); - - retval = shared->retval; - munmap((void *)shared, sizeof *shared); - - return retval; -} -#endif - - /* *----------------------------------------------------------------------------- * @@ -2711,21 +2579,6 @@ HostinfoGetKernelZoneElemSizeZprint(char const *name) // IN: Kernel zone name size_t Hostinfo_GetKernelZoneElemSize(char const *name) // IN: Kernel zone name { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 // Compiles against SDK version < 10.7 - typedef struct { - char mzn_name[80]; - } mach_zone_name_t; - typedef struct { - uint64_t mzi_count; - uint64_t mzi_cur_size; - uint64_t mzi_max_size; - uint64_t mzi_elem_size; - uint64_t mzi_alloc_size; - uint64_t mzi_sum_size; - uint64_t mzi_exhaustible; - uint64_t mzi_collectable; - } mach_zone_info_t; -#endif size_t result = 0; mach_zone_name_t *namesPtr; mach_msg_type_number_t namesSize; @@ -2734,16 +2587,6 @@ Hostinfo_GetKernelZoneElemSize(char const *name) // IN: Kernel zone name kern_return_t kr; mach_msg_type_number_t i; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 // Must run on Mac OS versions < 10.7 - kern_return_t (*mach_zone_info)(host_t host, - mach_zone_name_t **names, mach_msg_type_number_t *namesCnt, - mach_zone_info_t **info, mach_msg_type_number_t *infoCnt) = - dlsym(RTLD_DEFAULT, "mach_zone_info"); - if (!mach_zone_info) { - return HostinfoGetKernelZoneElemSizeZprint(name); - } -#endif - ASSERT(name); kr = mach_zone_info(mach_host_self(), &namesPtr, &namesSize, &infosPtr,