Changeset View
Changeset View
Standalone View
Standalone View
graphics/mesa-dri/files/patch-src_util_u__process.c
--- src/util/u_process.c.orig 2020-10-05 09:53:46 UTC | --- src/util/u_process.c.orig 2021-06-30 18:18:56 UTC | ||||
+++ src/util/u_process.c | +++ src/util/u_process.c | ||||
@@ -44,6 +44,11 @@ | @@ -94,22 +94,13 @@ __getProgramName() | ||||
#include <mach-o/dyld.h> | # define GET_PROGRAM_NAME() __getProgramName() | ||||
#elif defined(HAVE_PROGRAM_INVOCATION_NAME) | |||||
# define GET_PROGRAM_NAME() program_invocation_short_name | |||||
-#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2) | |||||
-# include <osreldate.h> | |||||
-# if (__FreeBSD_version >= 440000) | |||||
-# define GET_PROGRAM_NAME() getprogname() | |||||
-# endif | |||||
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__) || defined(ANDROID) | |||||
+# define GET_PROGRAM_NAME() getprogname() | |||||
#elif defined(__NetBSD__) | |||||
# include <sys/param.h> | |||||
# if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106000100) | |||||
# define GET_PROGRAM_NAME() getprogname() | |||||
#endif | # endif | ||||
-#elif defined(__DragonFly__) | |||||
+#if DETECT_OS_FREEBSD | -# define GET_PROGRAM_NAME() getprogname() | ||||
+#include <sys/types.h> | -#elif defined(__APPLE__) | ||||
+#include <sys/sysctl.h> | -# define GET_PROGRAM_NAME() getprogname() | ||||
+#endif | -#elif defined(ANDROID) | ||||
+ | -# define GET_PROGRAM_NAME() getprogname() | ||||
#if defined(__linux__) && defined(HAVE_PROGRAM_INVOCATION_NAME) | #elif defined(__sun) | ||||
/* Solaris has getexecname() which returns the full path - return just | |||||
static char *path = NULL; | the basename to match BSD getprogname() */ | ||||
@@ -175,6 +180,14 @@ util_get_process_exec_path(char* process_path, size_t | |||||
int result = _NSGetExecutablePath(process_path, &bufSize); | |||||
return (result == 0) ? strlen(process_path) : 0; | |||||
+#elif DETECT_OS_FREEBSD | |||||
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; | |||||
+ size_t read_len = len; | |||||
+ | |||||
+ (void) sysctl(mib, 4, process_path, &read_len, NULL, 0); | |||||
+ process_path[len - 1] = '\0'; | |||||
+ | |||||
+ return read_len; | |||||
#elif DETECT_OS_UNIX | |||||
ssize_t r; | |||||