added support for SunOS

This commit is contained in:
Thomas Willems 2017-10-20 16:05:43 +02:00 committed by Gregory Pakosz
parent 08b7ee02a3
commit f3c700e059
2 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Supported platforms:
- Android - Android
- QNX Neutrino - QNX Neutrino
- FreeBSD - FreeBSD
- SunOS
Just drop `whereami.h` and `whereami.c` into your build and get started. (see Just drop `whereami.h` and `whereami.c` into your build and get started. (see
also [customizing compilation]) also [customizing compilation])

View File

@ -158,7 +158,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
return length; return length;
} }
#elif defined(__linux__) || defined(__CYGWIN__) #elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun)
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -170,8 +170,12 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length)
#include <inttypes.h> #include <inttypes.h>
#if !defined(WAI_PROC_SELF_EXE) #if !defined(WAI_PROC_SELF_EXE)
#if defined(__sun)
#define WAI_PROC_SELF_EXE "/proc/self/path/a.out"
#else
#define WAI_PROC_SELF_EXE "/proc/self/exe" #define WAI_PROC_SELF_EXE "/proc/self/exe"
#endif #endif
#endif
WAI_FUNCSPEC WAI_FUNCSPEC
int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length) int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
@ -217,8 +221,12 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
#endif #endif
#if !defined(WAI_PROC_SELF_MAPS) #if !defined(WAI_PROC_SELF_MAPS)
#if defined(__sun)
#define WAI_PROC_SELF_MAPS "/proc/self/map"
#else
#define WAI_PROC_SELF_MAPS "/proc/self/maps" #define WAI_PROC_SELF_MAPS "/proc/self/maps"
#endif #endif
#endif
#if defined(__ANDROID__) || defined(ANDROID) #if defined(__ANDROID__) || defined(ANDROID)
#include <fcntl.h> #include <fcntl.h>