diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-13 15:06:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-13 20:31:42 +0100 |
commit | 1aae667817ddbe7b35bc2be4cc81c991eeda2e0e (patch) | |
tree | 0e1be32d99d699484006c2b4b5c465ce1c13c842 /sal | |
parent | aa5755e6dc03258c53a626aa74566d1307bf6136 (diff) |
AIX port
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/osl/endian.h | 8 | ||||
-rw-r--r-- | sal/inc/rtl/uuid.h | 2 | ||||
-rw-r--r-- | sal/inc/sal/alloca.h | 2 | ||||
-rw-r--r-- | sal/inc/sal/config.h | 2 | ||||
-rw-r--r-- | sal/inc/sal/main.h | 8 | ||||
-rwxr-xr-x | sal/osl/unx/backtrace.c | 11 | ||||
-rw-r--r-- | sal/osl/unx/file_error_transl.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 13 | ||||
-rw-r--r-- | sal/osl/unx/interlck.c | 2 | ||||
-rw-r--r-- | sal/osl/unx/makefile.mk | 2 | ||||
-rw-r--r-- | sal/osl/unx/module.c | 66 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.c | 8 | ||||
-rw-r--r-- | sal/osl/unx/process.c | 2 | ||||
-rw-r--r-- | sal/osl/unx/security.c | 3 | ||||
-rw-r--r-- | sal/osl/unx/socket.c | 4 | ||||
-rw-r--r-- | sal/osl/unx/system.c | 1 | ||||
-rw-r--r-- | sal/osl/unx/system.h | 19 | ||||
-rw-r--r-- | sal/osl/unx/tempfile.c | 18 | ||||
-rw-r--r-- | sal/rtl/source/alloc.c | 4 | ||||
-rw-r--r-- | sal/rtl/source/alloc_global.c | 2 | ||||
-rw-r--r-- | sal/rtl/source/macro.hxx | 2 | ||||
-rw-r--r-- | sal/rtl/source/makefile.mk | 6 |
22 files changed, 149 insertions, 38 deletions
diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h index b79c1f6456ac..5f07162d4005 100644 --- a/sal/inc/osl/endian.h +++ b/sal/inc/osl/endian.h @@ -106,9 +106,13 @@ extern "C" { #ifdef AIX # include <sys/machine.h> # if BYTE_ORDER == LITTLE_ENDIAN -# define _LITTLE_ENDIAN +# ifndef _LITTLE_ENDIAN +# define _LITTLE_ENDIAN +# endif # elif BYTE_ORDER == BIG_ENDIAN -# define _BIG_ENDIAN +# ifndef _BIG_ENDIAN +# define _BIG_ENDIAN +# endif # elif BYTE_ORDER == PDP_ENDIAN # define _PDP_ENDIAN # endif diff --git a/sal/inc/rtl/uuid.h b/sal/inc/rtl/uuid.h index 3ff5bb2c1232..56e4acdf4348 100644 --- a/sal/inc/rtl/uuid.h +++ b/sal/inc/rtl/uuid.h @@ -198,6 +198,8 @@ void SAL_CALL rtl_createNamedUuid( #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10 #elif MACOSX #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 100000 +#elif AIX +#define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10 #else #error "System time resolution must be calculated!" #endif diff --git a/sal/inc/sal/alloca.h b/sal/inc/sal/alloca.h index 17c242c4d1e2..a54025c2eb51 100644 --- a/sal/inc/sal/alloca.h +++ b/sal/inc/sal/alloca.h @@ -28,7 +28,7 @@ #ifndef INCLUDED_SAL_ALLOCA_H #define INCLUDED_SAL_ALLOCA_H -#if defined (SOLARIS) || defined (LINUX) || defined(__EMX__) +#if defined (SOLARIS) || defined (LINUX) || defined(__EMX__) || defined(AIX) #ifndef INCLUDED_ALLOCA_H #include <alloca.h> diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h index 1e8656a3ec14..59ca36a4fc96 100644 --- a/sal/inc/sal/config.h +++ b/sal/inc/sal/config.h @@ -91,7 +91,7 @@ #define SAL_SYSCONFIGFILE( name ) name ".ini" #endif -#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(SCO) +#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(SCO) || defined(AIX) #define SAL_UNX #define SAL_DLLEXTENSION ".so" #define SAL_DLLPREFIX "lib" diff --git a/sal/inc/sal/main.h b/sal/inc/sal/main.h index f360e4c95f19..c6841a96e313 100644 --- a/sal/inc/sal/main.h +++ b/sal/inc/sal/main.h @@ -29,6 +29,9 @@ #define _SAL_MAIN_H_ #include <sal/types.h> +#if defined(AIX) +# include <unistd.h> +#endif #ifdef __cplusplus extern "C" { @@ -44,7 +47,7 @@ int SAL_CALL main(int argc, char ** argv) \ sal_detail_initialize(argc, argv); \ ret = sal_main_with_args(argc, argv); \ sal_detail_deinitialize(); \ - return ret; \ + return x; \ } #define SAL_MAIN_IMPL \ @@ -54,10 +57,9 @@ int SAL_CALL main(int argc, char ** argv) \ sal_detail_initialize(argc, argv); \ ret = sal_main(); \ sal_detail_deinitialize(); \ - return ret; \ + return x; \ } - /* Definition macros for CRT entries */ #ifdef SAL_W32 diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index 00156b80f1d6..ee29d18c834e 100755 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -357,3 +357,14 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) } #endif /* defined MACOSX */ + +#if defined(AIX) +int backtrace( void **buffer, int max_frames ) +{ + return 0; +} + +void backtrace_symbols_fd( void **buffer, int size, int fd ) +{ +} +#endif diff --git a/sal/osl/unx/file_error_transl.cxx b/sal/osl/unx/file_error_transl.cxx index 3de829afc391..ff593c67d351 100644 --- a/sal/osl/unx/file_error_transl.cxx +++ b/sal/osl/unx/file_error_transl.cxx @@ -206,9 +206,11 @@ oslFileError oslTranslateFileError(sal_Bool bIsError, int Errno) osl_error = osl_File_E_NOSYS; break; +#if !defined(AIX) || !(defined(_ALL_SOURCE) && !defined(_LINUX_SOURCE_COMPAT)) case ENOTEMPTY: osl_error = osl_File_E_NOTEMPTY; break; +#endif case ELOOP: osl_error = osl_File_E_LOOP; diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 2ccd0ef63cc9..50754cc33c0a 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -252,7 +252,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI #else /* no statfs available */ # define __OSL_STATFS_STRUCT struct dummy {int i;} -# define __OSL_STATFS_INIT(a) ((void)0) +# define __OSL_STATFS_INIT(a) ((void)a) # define __OSL_STATFS(dir, sfs) (1) # define __OSL_STATFS_ISREMOTE(sfs) (0) # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) @@ -540,7 +540,7 @@ oslFileError osl_releaseVolumeDeviceHandle( oslVolumeDeviceHandle Handle ) return osl_File_E_None; } -#ifndef MACOSX +#if !defined(MACOSX) && !defined(AIX) /***************************************** * osl_newVolumeDeviceHandleImpl @@ -1116,23 +1116,26 @@ osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice) * *****************************************************************************/ -#if (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) +#if (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX)) static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath) { + (void)pszPath; return NULL; } #endif /* MACOSX */ -#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) +#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX)) static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy) { + (void)hFloppy; return osl_File_E_BUSY; } #endif /* MACOSX */ -#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD)) +#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX)) static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy) { + (void)hFloppy; return osl_File_E_BUSY; } #endif /* MACOSX */ diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c index 0342cdd983b4..5c7ff00d40cc 100644 --- a/sal/osl/unx/interlck.c +++ b/sal/osl/unx/interlck.c @@ -93,7 +93,7 @@ oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* return --nCount; } -#elif defined ( GCC ) && defined ( POWERPC ) +#elif defined ( GCC ) && defined ( POWERPC ) && !defined( AIX ) /*****************************************************************************/ /* osl_incrementInterlockedCount */ diff --git a/sal/osl/unx/makefile.mk b/sal/osl/unx/makefile.mk index 1dd47fb4d19b..d41a887b2111 100644 --- a/sal/osl/unx/makefile.mk +++ b/sal/osl/unx/makefile.mk @@ -118,7 +118,7 @@ OBJFILES= $(OBJ)$/conditn.obj \ SLOFILES += $(SLO)$/osxlocale.obj .ENDIF -.IF "$(OS)"=="SOLARIS" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || "$(OS)$(CPU)"=="LINUXS" || "$(OS)"=="MACOSX" +.IF "$(OS)"=="SOLARIS" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || "$(OS)$(CPU)"=="LINUXS" || "$(OS)"=="MACOSX" || "$(OS)"=="AIX" SLOFILES += $(SLO)$/backtrace.obj OBJFILES += $(OBJ)$/backtrace.obj .ENDIF diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 8f8f76a8656c..08f220b89f7b 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -38,6 +38,10 @@ #include <stdio.h> #endif +#ifdef AIX +#include <sys/ldr.h> +#endif + /* implemented in file.c */ extern int UnicodeToText(char *, size_t, const sal_Unicode *, sal_Int32); @@ -201,6 +205,67 @@ osl_getFunctionSymbol(oslModule module, rtl_uString *puFunctionSymbolName) sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibraryUrl) { sal_Bool result = sal_False; +#if defined(AIX) + int i; + int size = 4 * 1024; + char *buf, *filename=NULL; + struct ld_info *lp; + + if ((buf = malloc(size)) == NULL) + return result; + + while((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) + { + size += 4 * 1024; + if ((buf = malloc(size)) == NULL) + break; + } + + lp = (struct ld_info*) buf; + while (lp) + { + unsigned long start = (unsigned long)lp->ldinfo_dataorg; + unsigned long end = start + lp->ldinfo_datasize; + if (start <= (unsigned long)addr && end > (unsigned long)addr) + { + filename = lp->ldinfo_filename; + break; + } + if (!lp->ldinfo_next) + break; + lp = (struct ld_info*) ((char *) lp + lp->ldinfo_next); + } + + if (filename) + { + rtl_uString * workDir = NULL; + osl_getProcessWorkingDir(&workDir); + if (workDir) + { +#if OSL_DEBUG_LEVEL > 1 + OSL_TRACE("module.c::osl_getModuleURLFromAddress - %s\n", filaname); +#endif + rtl_string2UString(ppLibraryUrl, + filename, + strlen(filename), + osl_getThreadTextEncoding(), + OSTRING_TO_OUSTRING_CVTFLAGS); + + OSL_ASSERT(*ppLibraryUrl != NULL); + osl_getFileURLFromSystemPath(*ppLibraryUrl, ppLibraryUrl); + osl_getAbsoluteFileURL(workDir, *ppLibraryUrl, ppLibraryUrl); + + rtl_uString_release(workDir); + result = sal_True; + } + else + { + result = sal_False; + } + } + + free(buf); +#else Dl_info dl_info; if ((result = dladdr(addr, &dl_info)) != 0) @@ -230,6 +295,7 @@ sal_Bool SAL_CALL osl_getModuleURLFromAddress(void * addr, rtl_uString ** ppLibr result = sal_False; } } +#endif return result; } diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index 48c181015d6a..56bae87c10ce 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -924,7 +924,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) { /* only change env vars that exist already */ if( getenv( "LC_ALL" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined ( AIX ) setenv( "LC_ALL", locale_buf, 1); #else setenv( "LC_ALL", locale_buf ); @@ -932,7 +932,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LC_CTYPE" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined ( AIX ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LC_CTYPE", locale_buf ); @@ -940,7 +940,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LANG" ) ) { -#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined (AIX ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LANG", locale_buf ); @@ -951,6 +951,6 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) return 0; } -#endif /* ifdef LINUX || SOLARIS || MACOSX || NETBSD */ +#endif /* ifdef LINUX || SOLARIS || MACOSX || NETBSD || AIX */ diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index 4a5cb7b45414..83531c64092c 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -70,7 +70,7 @@ #define MAX_ARGS 255 #define MAX_ENVS 255 -#if defined(MACOSX) || defined(IORESOURCE_TRANSFER_BSD) +#if defined(MACOSX) || defined(IORESOURCE_TRANSFER_BSD) || defined(AIX) #define CONTROLLEN (sizeof(struct cmsghdr) + sizeof(int)) #endif diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index d08326e65ebe..e2fa6e2e2734 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -504,6 +504,9 @@ osl_psz_loginUser(const sal_Char* pszUserName, const sal_Char* pszPasswd, { #if defined NETBSD || defined SCO || defined AIX || defined FREEBSD || \ defined MACOSX + (void)pszUserName; + (void)pszPasswd; + (void)pSecurity; return osl_Security_E_None; diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index c8faf6c028f5..a47567167721 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -802,6 +802,10 @@ static struct hostent* _osl_gethostbyname_r ( __error = gethostbyname_r (name, result, buffer, buflen, &__result, h_errnop); return __error ? NULL : __result ; +#elif defined(AIX) + *h_errnop = gethostbyname_r (name, result, (struct hostent_data *)buffer); + (void)buflen; + return *h_errnop ? NULL : result ; #else return gethostbyname_r( name, result, buffer, buflen, h_errnop); #endif diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index a8aef1852c62..e6106396b66c 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -485,6 +485,7 @@ pid_t getpid(void) #ifdef NO_PTHREAD_SEMAPHORES int sem_init(sem_t* sem, int pshared, unsigned int value) { + (void)pshared; pthread_mutex_init(&sem->mutex, PTHREAD_MUTEXATTR_DEFAULT); pthread_cond_init(&sem->increased, PTHREAD_CONDATTR_DEFAULT); diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index e41317261a31..cef39848f83b 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -110,9 +110,13 @@ # include <dlfcn.h> # include <endian.h> # if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LITTLE_ENDIAN +# ifndef _LITTLE_ENDIAN +# define _LITTLE_ENDIAN +# endif # elif __BYTE_ORDER == __BIG_ENDIAN -# define _BIG_ENDIAN +# ifndef _BIG_ENDIAN +# define _BIG_ENDIAN +# endif # elif __BYTE_ORDER == __PDP_ENDIAN # define _PDP_ENDIAN # endif @@ -230,22 +234,25 @@ extern unsigned int nanosleep(unsigned int); # define AF_IPX -1 # include <strings.h> # include <pthread.h> +# include <dlfcn.h> # include <sys/time.h> # include <sys/un.h> # include <netinet/tcp.h> # include <sys/machine.h> # if BYTE_ORDER == LITTLE_ENDIAN -# define _LITTLE_ENDIAN +# ifndef _LITTLE_ENDIAN +# define _LITTLE_ENDIAN +# endif # elif BYTE_ORDER == BIG_ENDIAN -# define _BIG_ENDIAN +# ifndef _BIG_ENDIAN +# define _BIG_ENDIAN +# endif # elif BYTE_ORDER == PDP_ENDIAN # define _PDP_ENDIAN # endif -# define sched_yield() pthread_yield() # define SLEEP_TIMESPEC(timespec) nsleep(×pec, 0) # define LIBPATH "LIBPATH" # define NO_PTHREAD_SEMAPHORES -# define NO_DL_FUNCTIONS #endif #ifdef HPUX diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c index 02859e67ba51..107b1eafcd84 100644 --- a/sal/osl/unx/tempfile.c +++ b/sal/osl/unx/tempfile.c @@ -66,16 +66,18 @@ oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir ) const char *pValue = getenv( "TEMP" ); if ( !pValue ) - { pValue = getenv( "TMP" ); -#if defined(SOLARIS) || defined (LINUX) || defined (FREEBSD) - if ( !pValue ) - pValue = P_tmpdir; -#elif defined(NETBSD) - if ( !pValue ) - pValue = _PATH_TMP; + +#if defined(NETBSD) + if ( !pValue ) + pValue = _PATH_TMP; +#else + if ( !pValue ) + pValue = P_tmpdir; #endif - } + + if ( !pValue ) + pValue = "/tmp"; #endif /* MACOSX */ if ( pValue ) diff --git a/sal/rtl/source/alloc.c b/sal/rtl/source/alloc.c index 67828bb6adb1..79e909ab52ce 100644 --- a/sal/rtl/source/alloc.c +++ b/sal/rtl/source/alloc.c @@ -75,7 +75,7 @@ static sal_Size __rtl_memory_vmpagesize (void) /* xBSD */ return (sal_Size)(getpagesize()); } -#elif defined(LINUX) || defined(SOLARIS) +#elif defined(LINUX) || defined(SOLARIS) || defined(AIX) static sal_Size __rtl_memory_vmpagesize (void) { /* POSIX */ @@ -87,7 +87,7 @@ static sal_Size __rtl_memory_vmpagesize (void) /* other */ return (sal_Size)(0x2000); } -#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS */ +#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS || AIX */ #ifndef PROT_HEAP #define PROT_HEAP (PROT_READ | PROT_WRITE | PROT_EXEC) diff --git a/sal/rtl/source/alloc_global.c b/sal/rtl/source/alloc_global.c index 5137f868127d..0e8be8683491 100644 --- a/sal/rtl/source/alloc_global.c +++ b/sal/rtl/source/alloc_global.c @@ -157,7 +157,7 @@ rtl_memory_init (void) Delegated the call to "rtl_memory_fini" into a dummy C++ object, see memory_fini.cxx . */ -#if defined(__GNUC__) && !defined(MACOSX) +#if defined(__GNUC__) && !defined(MACOSX) && !defined(AIX) static void rtl_memory_fini (void) __attribute__((destructor)); #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) #pragma fini(rtl_memory_fini) diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx index 3fa0fbe58f42..f704422c05c7 100644 --- a/sal/rtl/source/macro.hxx +++ b/sal/rtl/source/macro.hxx @@ -50,6 +50,8 @@ #define THIS_OS "NetBSD" #elif defined FREEBSD #define THIS_OS "FreeBSD" +#elif defined AIX +#define THIS_OS "AIX" #endif #if ! defined THIS_OS diff --git a/sal/rtl/source/makefile.mk b/sal/rtl/source/makefile.mk index 517d2c2df2a3..b8f40170693b 100644 --- a/sal/rtl/source/makefile.mk +++ b/sal/rtl/source/makefile.mk @@ -61,7 +61,9 @@ UWINAPILIB:= .IF "$(header)" == "" +.IF "$(OS)" != "AIX" ALWAYSDBGFILES=$(SLO)$/debugprint.obj +.ENDIF .IF "$(ALWAYSDBGFILES)" != "" ALWAYSDBGTARGET=do_it_alwaysdebug @@ -95,7 +97,7 @@ SLOFILES= \ $(SLO)$/alloc_cache.obj \ $(SLO)$/alloc_arena.obj -.IF "$(OS)"=="MACOSX" +.IF "$(OS)"=="MACOSX" || "$(OS)"=="AIX" SLOFILES+=$(SLO)$/memory_fini.obj .ENDIF @@ -128,7 +130,7 @@ OBJFILES= \ $(OBJ)$/alloc_cache.obj \ $(OBJ)$/alloc_arena.obj -.IF "$(OS)"=="MACOSX" +.IF "$(OS)"=="MACOSX" || "$(OS)"=="AIX" OBJFILES+=$(OBJ)$/memory_fini.obj .ENDIF |