]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Define Posix_Printf/Posix_Fprint for FreeBSD
authorKruti Pendharkar <kp025370@broadcom.com>
Fri, 11 Jul 2025 12:48:15 +0000 (05:48 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Fri, 11 Jul 2025 12:48:15 +0000 (05:48 -0700)
A previous change to lib/misc/posixPosix.c introduced the
`Posix_Printf` and `Posix_Fprintf` implementations only for non-Solaris,
non-Apple, and non-FreeBSD builds. (Note that this set of
conditions is inconsistent with when `posix.h` aliases them
(and various other functions) to their standard POSIX
counterparts.)

Moving the `Posix_Printf`/`Posix_Fprintf` implementations out
of the `#if` sections so that they're always available.

open-vm-tools/lib/include/posix.h
open-vm-tools/lib/misc/posixPosix.c

index c2a38673f80a2a32ec8d8d5c2469bdac661b853c..702f09710155b66804b92df0deb26d5472541d54 100644 (file)
@@ -665,7 +665,7 @@ exit:
 /*
  * ESX and Mac OS are UTF-8 environments so these functions can be
  * "defined away" - the POSIX wrapper call can be directly mapped to the
- * POSIX function avoiding unneccesary (call and handling) overhead.
+ * POSIX function avoiding unnecessary (call and handling) overhead.
  *
  * NOTE: PLEASE KEEP THESE IN SORTED ORDER
  */
index 236c18dbceb7eba993c145522943c356abb3943d..e98e7b755a5d709921be01f886a69e2c9b44237f 100644 (file)
@@ -19,7 +19,7 @@
 #define UNICODE_BUILDING_POSIX_WRAPPERS
 
 #if __linux__
-#define _GNU_SOURCE // Needed to get euidaccess()
+   #define _GNU_SOURCE // Needed to get euidaccess()
 #endif
 
 #include <stdio.h>
 #include <stdarg.h>
 
 #if defined(__APPLE__)
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/kauth.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <CoreFoundation/CoreFoundation.h>
-#include <TargetConditionals.h>
-#if TARGET_OS_IPHONE
-#include <spawn.h>
-extern char **environ;
-#endif
+   #include <sys/socket.h>
+   #include <sys/un.h>
+   #include <netinet/in.h>
+   #include <arpa/inet.h>
+   #include <sys/time.h>
+   #include <sys/uio.h>
+   #include <sys/kauth.h>
+   #include <sys/param.h>
+   #include <sys/mount.h>
+   #include <CoreFoundation/CoreFoundation.h>
+   #include <TargetConditionals.h>
+
+   #if TARGET_OS_IPHONE
+      #include <spawn.h>
+      extern char **environ;
+   #endif
 #elif defined(__FreeBSD__)
-#include <sys/param.h>
-#include <sys/mount.h>
+   #include <sys/param.h>
+   #include <sys/mount.h>
 #elif defined(sun)
-#include <alloca.h>
-#include <sys/mnttab.h>
+   #include <alloca.h>
+   #include <sys/mnttab.h>
 #else
-#include <sys/statfs.h>
-#include <sys/mount.h>
-#include <mntent.h>
+   #include <sys/statfs.h>
+   #include <sys/mount.h>
+   #include <mntent.h>
 #endif
 
 #if (!defined(__FreeBSD__) || __FreeBSD_release >= 503001) && !defined __ANDROID__
-#define VM_SYSTEM_HAS_GETPWNAM_R 1
-#define VM_SYSTEM_HAS_GETPWUID_R 1
-#define VM_SYSTEM_HAS_GETGRNAM_R 1
+   #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__)
-#  include <sys/syslimits.h>  // PATH_MAX
-# else
-#  include <limits.h>  // PATH_MAX
-# endif
+#if defined(__FreeBSD__)
+   #include <sys/syslimits.h>  // PATH_MAX
+#else
+   #include <limits.h>  // PATH_MAX
+#endif
 
 #include "vmware.h"
 #include "posixInt.h"
 #if defined(sun)
-#include "hashTable.h" // For setenv emulation
+   #include "hashTable.h" // For setenv emulation
 #endif
 
 #include "vm_basic_defs.h"
 
 #if defined __ANDROID__
-/*
- * Android doesn't support getmntent_r() or setmntent().
- */
-#define NO_GETMNTENT_R
-#define NO_SETMNTENT
+   /*
  * Android doesn't support getmntent_r() or setmntent().
  */
+   #define NO_GETMNTENT_R
+   #define NO_SETMNTENT
 
-EXTERN int truncate(const char *, off_t);
+   EXTERN int truncate(const char *, off_t);
 #endif
 
 
@@ -1804,9 +1805,7 @@ Posix_Unsetenv(const char *name)  // IN:
 }
 
 
-#if !defined(sun) // {
-
-#if !defined(__APPLE__) && !defined(__FreeBSD__) // {
+#if !defined sun && !defined __APPLE__ && !defined __FreeBSD__ // {
 /*
  *----------------------------------------------------------------------
  *
@@ -2132,6 +2131,9 @@ exit:
 }
 
 
+#endif // } !defined sun && !defined __APPLE__ && !defined __FreeBSD
+
+
 /*
  *----------------------------------------------------------------------------
  *
@@ -2217,10 +2219,7 @@ Posix_Fprintf(FILE *stream,        // IN:
 }
 
 
-#endif // } !defined(__APPLE__) && !defined(__FreeBSD)
-
-
-#else  // } !defined(sun) {
+#if defined sun // {
 /*
  *----------------------------------------------------------------------
  *
@@ -2267,7 +2266,7 @@ Posix_Getmntent(FILE *fp,           // IN:
 
    return ret;
 }
-#endif // } !defined(sun)
+#endif // } defined sun
 
 
 /*