diff options
Diffstat (limited to 'sal/osl/unx')
-rw-r--r-- | sal/osl/unx/interlck.c | 11 | ||||
-rw-r--r-- | sal/osl/unx/makefile.mk | 6 | ||||
-rw-r--r-- | sal/osl/unx/module.c | 3 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.c | 6 | ||||
-rw-r--r-- | sal/osl/unx/osxlocale.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/salinit.cxx | 1 | ||||
-rw-r--r-- | sal/osl/unx/system.h | 1 | ||||
-rw-r--r-- | sal/osl/unx/tempfile.c | 42 | ||||
-rw-r--r-- | sal/osl/unx/thread.c | 49 | ||||
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 2 |
10 files changed, 65 insertions, 58 deletions
diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c index e5bb3ea1e..a32f67c11 100644 --- a/sal/osl/unx/interlck.c +++ b/sal/osl/unx/interlck.c @@ -149,17 +149,6 @@ oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* return --nCount; #endif } - -#elif ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 )) -oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) -{ - return __sync_add_and_fetch(pCount, 1); -} - -oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount) -{ - return __sync_sub_and_fetch(pCount, 1); -} #elif ( __GNUC__ > 4 ) || (( __GNUC__ == 4) && ( __GNUC_MINOR__ >= 4 )) oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) { diff --git a/sal/osl/unx/makefile.mk b/sal/osl/unx/makefile.mk index cb566aeb1..2ec11e16f 100644 --- a/sal/osl/unx/makefile.mk +++ b/sal/osl/unx/makefile.mk @@ -49,6 +49,10 @@ ENABLE_EXCEPTIONS=TRUE CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) +.IF "$(OS)" == "IOS" +CFLAGSCXX+=-D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 +.ENDIF + # --- Files -------------------------------------------------------- SLOFILES= \ @@ -113,7 +117,7 @@ OBJFILES= $(OBJ)$/conditn.obj \ $(OBJ)$/readwrite_helper.obj -.IF "$(OS)"=="MACOSX" +.IF "$(OS)"=="MACOSX" || "$(OS)"=="IOS" SLOFILES += $(SLO)$/osxlocale.obj .ENDIF diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index c06368cdc..a5beea9f6 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -208,7 +208,8 @@ osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName) sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibraryUrl) { sal_Bool result = sal_False; -#ifndef NO_DL_FUNCTIONS +/* Bah, we do want to use dladdr here also on iOS, I think? */ +#if !defined(NO_DL_FUNCTIONS) || defined(IOS) #if defined(AIX) int i; int size = 4 * 1024; diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index dcee27c8d..563aae980 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -35,13 +35,13 @@ defined(FREEBSD) || defined(MACOSX) || defined(IOS) || defined(OPENBSD) || \ defined(DRAGONFLY) #include <pthread.h> -#ifndef MACOSX +#if !defined(MACOSX) && !defined(IOS) #include <locale.h> #include <langinfo.h> #else #include <osl/module.h> #include <osl/thread.h> -#endif /* !MACOSX */ +#endif /* !MACOSX && !IOS */ #endif /* LINUX || SOLARIS || NETBSD || MACOSX || IOS */ #include <string.h> @@ -855,7 +855,7 @@ rtl_TextEncoding osl_getTextEncodingFromLocale( rtl_Locale * pLocale ) return RTL_TEXTENCODING_DONTKNOW; } -#ifdef MACOSX +#if defined(MACOSX) || defined(IOS) #include "system.h" /* OS X locale discovery function */ diff --git a/sal/osl/unx/osxlocale.cxx b/sal/osl/unx/osxlocale.cxx index 26434ef4e..37b34b200 100644 --- a/sal/osl/unx/osxlocale.cxx +++ b/sal/osl/unx/osxlocale.cxx @@ -33,7 +33,9 @@ #include <assert.h> #include <premac.h> +#ifndef IOS #include <CoreServices/CoreServices.h> +#endif #include <CoreFoundation/CoreFoundation.h> #include <postmac.h> diff --git a/sal/osl/unx/salinit.cxx b/sal/osl/unx/salinit.cxx index dd12d2f1c..9503443fe 100644 --- a/sal/osl/unx/salinit.cxx +++ b/sal/osl/unx/salinit.cxx @@ -30,7 +30,6 @@ #include "sal/config.h" #include "osl/process.h" -#include "sal/main.h" #include "sal/types.h" extern "C" { diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index d9c90d204..cc4d583ac 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -354,6 +354,7 @@ int macxp_resolveAlias(char *path, int buflen); # ifndef ETIME # define ETIME ETIMEDOUT # endif +# include <dlfcn.h> # include <pthread.h> # include <sys/file.h> # include <sys/ioctl.h> diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c index 862aff2c8..64ce56b3d 100644 --- a/sal/osl/unx/tempfile.c +++ b/sal/osl/unx/tempfile.c @@ -49,53 +49,29 @@ #include "file_url.h" #endif -/*****************************************************************/ -/* osl_getTempFirURL */ -/*****************************************************************/ - oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir ) { -#ifdef MACOSX + oslFileError error; + /* described in environ(7) */ const char *pValue = getenv( "TMPDIR" ); - /* If TMPDIR environment variable is not set, use "/tmp" instead - of P_tmpdir because its value is "/var/tmp" and it is not - deleted on system start up */ if ( !pValue ) - pValue = "/tmp"; -#else - - const char *pValue = getenv( "TEMP" ); + pValue = getenv( "TEMP" ); if ( !pValue ) pValue = getenv( "TMP" ); -#if defined(NETBSD) - if ( !pValue ) - pValue = _PATH_TMP; -#else - if ( !pValue ) - pValue = P_tmpdir; -#endif - if ( !pValue ) pValue = "/tmp"; -#endif /* MACOSX */ - if ( pValue ) - { - oslFileError error; - rtl_uString *ustrTempPath = NULL; + rtl_uString *ustrTempPath = NULL; - rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS ); - OSL_ASSERT(ustrTempPath != NULL); - error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir ); - rtl_uString_release( ustrTempPath ); + rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS ); + OSL_ASSERT(ustrTempPath != NULL); + error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir ); + rtl_uString_release( ustrTempPath ); - return error; - } - else - return osl_File_E_NOENT; + return error; } /****************************************************************** diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 06730acb2..b11edb0e2 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -35,6 +35,7 @@ #include <osl/thread.h> #include <osl/nlsupport.h> #include <rtl/textenc.h> +#include <rtl/alloc.h> #include <sal/macros.h> #if defined LINUX @@ -975,17 +976,31 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) return Priority; } +typedef struct _wrapper_pthread_key +{ + pthread_key_t m_key; + oslThreadKeyCallbackFunction pfnCallback; +} wrapper_pthread_key; + /*****************************************************************************/ /* osl_createThreadKey */ /*****************************************************************************/ oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallback ) { - pthread_key_t key; + wrapper_pthread_key *pKey = (wrapper_pthread_key*)rtl_allocateMemory(sizeof(wrapper_pthread_key)); + + if (pKey) + { + pKey->pfnCallback = pCallback; - if (pthread_key_create(&key, pCallback) != 0) - key = 0; + if (pthread_key_create(&(pKey->m_key), pKey->pfnCallback) != 0) + { + rtl_freeMemory(pKey); + pKey = 0; + } + } - return ((oslThreadKey)key); + return ((oslThreadKey)pKey); } /*****************************************************************************/ @@ -993,7 +1008,12 @@ oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallbac /*****************************************************************************/ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key) { - pthread_key_delete((pthread_key_t)Key); + wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + if (pKey) + { + pthread_key_delete(pKey->m_key); + rtl_freeMemory(pKey); + } } /*****************************************************************************/ @@ -1001,7 +1021,8 @@ void SAL_CALL osl_destroyThreadKey(oslThreadKey Key) /*****************************************************************************/ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key) { - return (pthread_getspecific((pthread_key_t)Key)); + wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + return pKey ? pthread_getspecific(pKey->m_key) : NULL; } /*****************************************************************************/ @@ -1009,7 +1030,21 @@ void* SAL_CALL osl_getThreadKeyData(oslThreadKey Key) /*****************************************************************************/ sal_Bool SAL_CALL osl_setThreadKeyData(oslThreadKey Key, void *pData) { - return (pthread_setspecific((pthread_key_t)Key, pData) == 0); + sal_Bool bRet; + void *pOldData = NULL; + wrapper_pthread_key *pKey = (wrapper_pthread_key*)Key; + if (!pKey) + return sal_False; + + if (pKey->pfnCallback) + pOldData = pthread_getspecific(pKey->m_key); + + bRet = (pthread_setspecific(pKey->m_key, pData) == 0); + + if (bRet && pKey->pfnCallback && pOldData) + pKey->pfnCallback(pOldData); + + return bRet; } /*****************************************************************************/ diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 2ba1f9d95..572f7a9ec 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -93,7 +93,7 @@ sal_Bool realpath_u(const rtl_uString* pustrFileName, rtl_uString** ppustrResolvedName) { #ifndef MACOSX // not MACOSX - rtl::OString fn = OUStringToOString(pustrFileName); + rtl::OString fn = OUStringToOString(pustrFileName); #else rtl::OString fn = macxp_resolveAliasAndConvert(pustrFileName); #endif |