Glibc version 2.2 dates from RedHat 7.1 (released 2001).
Any code we have on modern branches no longer works on
things that old (guest tools are frozen, hosted lost
support long ago).
This change removes a bunch of GLIBC_VERSION checks
from our code.
NOTE: GLIBC_VERSION_23 checks are still in use; we
support such old OSes (RH7.1-3, RH8.0, RHEL2.x) with
the guest tools build.
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-
-#ifndef GLIBC_VERSION_22
-#define __USE_XOPEN
-#endif
-#include <unistd.h> // for access, etc.
-
-#if (defined(GLIBC_VERSION_22) && !defined(USING_AUTOCONF)) || defined(HAVE_CRYPT_H)
-#include <crypt.h>
-#endif
+#include <unistd.h> // for access, crypt, etc.
#include "vmware.h"
#include "vm_version.h"
}
-#if defined(_WIN32) || defined(GLIBC_VERSION_21) || defined(__APPLE__) || \
+#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__) || \
defined(__FreeBSD__)
/*
*----------------------------------------------------------------------
}
-#if defined(GLIBC_VERSION_21) || defined(__APPLE__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
/*
*----------------------------------------------------------------------
return fret;
}
-#endif /* defined(GLIBC_VERSION_21) || defined(__APPLE__) || defined(__FreeBSD__) */
+#endif /* defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) */
#endif /* !defined(N_PLAT_NLM) */
/*
# include "sig.h"
#endif
-#if defined(linux) && !defined(GLIBC_VERSION_21)
-/*
- * Implements the system call (it is not wrapped by glibc 2.1.1)
- */
-static INLINE int
-_llseek(unsigned int fd,
- unsigned long offset_high,
- unsigned long offset_low,
- loff_t *result,
- unsigned int whence)
-{
- return syscall(SYS__llseek, fd, offset_high, offset_low, result, whence);
-}
-#endif
-
/*
* On Linux, we must wrap getdents64, as glibc does not wrap it for us. We use getdents64
* (rather than getdents) because with the latter, we'll get 64-bit offsets and inode
return EBADF;
}
-#if defined(GLIBC_VERSION_21) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
/* Read from the file. */
if (sequentialOpen) {
error = read(fd, payload, requiredSize);
return EBADF;
}
-#if defined(GLIBC_VERSION_21) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
/* Write to the file. */
if (sequentialOpen) {
error = write(fd, payload, requiredSize);
# define REG_R14 GNU_REG_R14
# define REG_R15 GNU_REG_R15
# elif defined(__i386__)
-# if GLIBC_VERSION_22
-# define REG_EAX GNU_REG_EAX
-# define REG_EBX GNU_REG_EBX
-# define REG_ECX GNU_REG_ECX
-# define REG_EDX GNU_REG_EDX
-# define REG_ESI GNU_REG_ESI
-# define REG_EDI GNU_REG_EDI
-# define REG_ESP GNU_REG_ESP
-# define REG_EBP GNU_REG_EBP
-# define REG_EIP GNU_REG_EIP
-# else
-# define EAX GNU_REG_EAX
-# define EBX GNU_REG_EBX
-# define ECX GNU_REG_ECX
-# define EDX GNU_REG_EDX
-# define ESI GNU_REG_ESI
-# define EDI GNU_REG_EDI
-# define ESP GNU_REG_ESP
-# define EBP GNU_REG_EBP
-# define EIP GNU_REG_EIP
-# endif
+# define REG_EAX GNU_REG_EAX
+# define REG_EBX GNU_REG_EBX
+# define REG_ECX GNU_REG_ECX
+# define REG_EDX GNU_REG_EDX
+# define REG_ESI GNU_REG_ESI
+# define REG_EDI GNU_REG_EDI
+# define REG_ESP GNU_REG_ESP
+# define REG_EBP GNU_REG_EBP
+# define REG_EIP GNU_REG_EIP
# endif
#endif
# undef REG_R14
# undef REG_R15
# elif defined(__i386__)
-# if GLIBC_VERSION_22
-# undef REG_EAX
-# undef REG_EBX
-# undef REG_ECX
-# undef REG_EDX
-# undef REG_ESI
-# undef REG_EDI
-# undef REG_ESP
-# undef REG_EBP
-# undef REG_EIP
-# else
-# undef EAX
-# undef EBX
-# undef ECX
-# undef EDX
-# undef ESI
-# undef EDI
-# undef ESP
-# undef EBP
-# undef EIP
-# endif
+# undef REG_EAX
+# undef REG_EBX
+# undef REG_ECX
+# undef REG_EDX
+# undef REG_ESI
+# undef REG_EDI
+# undef REG_ESP
+# undef REG_EBP
+# undef REG_EIP
# endif
#endif
#define INCLUDE_ALLOW_VMCORE
#include "includeCheck.h"
-#if defined(GLIBC_VERSION_22)
+#if defined(__linux__)
#include <wchar.h>
#elif defined(_WIN32)
#include <tchar.h>
EXTERN char *Str_SafeVasprintf(size_t *length, const char *format,
va_list arguments);
-#if defined(_WIN32) || defined(GLIBC_VERSION_22) // {
+#if defined(_WIN32) || defined(__linux__) // {
/*
* wchar_t versions
#endif
#endif
-#endif // } defined(_WIN32) || defined(GLIBC_VERSION_22)
+#endif // } defined(_WIN32) || defined(__linux__)
/*
* change bufIn so a simple cast is safe. --plangdale
*/
-#if defined(GLIBC_VERSION_22) || (!defined(__i386__) && !defined(__x86_64__))
+#ifdef __linux__
status = iconv(cd, (char **)&bufIn, &sizeIn, &out, &outLeft);
#else
status = iconv(cd, &bufIn, &sizeIn, &out, &outLeft);
float *avg1, // IN/OUT:
float *avg2) // IN/OUT:
{
- /* getloadavg(3) was introduced with glibc 2.2 */
-#if defined(GLIBC_VERSION_22) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
double avg[3];
int res;
#include "vm_atomic.h"
#if defined(__linux__)
-#if !defined(GLIBC_VERSION_21) && (defined(__i386__) || defined(__x86_64__))
-/*
- * SYS_ constants for glibc 2.0, some of which may already be defined on
- * some of those older systems.
- */
-
-#ifndef SYS_setresuid
-#define SYS_setresuid 164
-#endif
-#ifndef SYS_setresgid
-#define SYS_setresgid 170
-#endif
-#define SYS_setreuid32 203
-#define SYS_setregid32 204
-#define SYS_setresuid32 208
-#define SYS_setresgid32 210
-#define SYS_setuid32 213
-#define SYS_setgid32 214
-#endif // ifndef GLIBC_VERSION_21
-
/*
* 64bit linux has no 16 bit versions and
* the 32bit versions have the un-suffixed names.
* for x86, so we just assume it's already there.)
*
* XXX Str_Vsnwprintf and friends are still protected by _WIN32 and
- * GLIBC_VERSION_22. I.e., even though they should be able to work on
+ * glibc >= 2.2. I.e., even though they should be able to work on
* FreeBSD 5.0+ and Solaris 8+, they aren't made available there.
*/
-# if !(defined(GLIBC_VERSION_22) || \
+# if !(defined(__linux__) || \
(defined(__FreeBSD__) && (__FreeBSD_version >= 500000)) || \
defined(sun))
extern int vswprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, va_list args);
return StrVasprintfInternal(length, format, arguments, TRUE);
}
-#if defined(_WIN32) || defined(GLIBC_VERSION_22)
+#if defined(_WIN32) || defined(__linux__)
/*
*----------------------------------------------------------------------
return StrVaswprintfInternal(length, format, arguments, TRUE);
}
-#endif // defined(_WIN32) || defined(GLIBC_VERSION_22)
+#endif // defined(_WIN32) || defined(__linux__)
#ifndef _WIN32