diff --git a/README.md b/README.md index 671260a..3fd39b2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Supported platforms: - Android - QNX Neutrino - FreeBSD +- SunOS Just drop `whereami.h` and `whereami.c` into your build and get started. (see also [customizing compilation]) diff --git a/src/whereami.c b/src/whereami.c index aa1c2d4..f51ea85 100644 --- a/src/whereami.c +++ b/src/whereami.c @@ -158,7 +158,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length) return length; } -#elif defined(__linux__) || defined(__CYGWIN__) +#elif defined(__linux__) || defined(__CYGWIN__) || defined(__sun) #include #include @@ -170,8 +170,12 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length) #include #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" #endif +#endif WAI_FUNCSPEC 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 #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" #endif +#endif #if defined(__ANDROID__) || defined(ANDROID) #include