diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/osl/endian.h | 17 | ||||
-rw-r--r-- | sal/inc/osl/thread.hxx | 4 | ||||
-rw-r--r-- | sal/inc/rtl/math.hxx | 21 | ||||
-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/osl/os2/file.cxx | 4 | ||||
-rw-r--r-- | sal/osl/os2/nlsupport.c | 21 | ||||
-rw-r--r-- | sal/osl/os2/socket.c | 2 | ||||
-rw-r--r-- | sal/osl/os2/system.h | 32 | ||||
-rwxr-xr-x | sal/osl/unx/backtrace.c | 48 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 18 | ||||
-rw-r--r-- | sal/osl/unx/file_volume.cxx | 425 | ||||
-rw-r--r-- | sal/osl/unx/module.c | 26 | ||||
-rw-r--r-- | sal/osl/unx/nlsupport.c | 50 | ||||
-rw-r--r-- | sal/osl/unx/process.c | 108 | ||||
-rw-r--r-- | sal/osl/unx/profile.c | 12 | ||||
-rw-r--r-- | sal/osl/unx/socket.c | 21 | ||||
-rw-r--r-- | sal/osl/unx/system.h | 31 | ||||
-rw-r--r-- | sal/rtl/source/alloc.c | 4 | ||||
-rw-r--r-- | sal/rtl/source/bootstrap.cxx | 4 | ||||
-rw-r--r-- | sal/rtl/source/macro.hxx | 4 | ||||
-rw-r--r-- | sal/rtl/source/math.cxx | 9 | ||||
-rw-r--r-- | sal/util/makefile.mk | 9 | ||||
-rw-r--r-- | sal/util/salalloc.list | 7 |
25 files changed, 122 insertions, 761 deletions
diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h index b0d2922839be..09529a48840f 100644 --- a/sal/inc/osl/endian.h +++ b/sal/inc/osl/endian.h @@ -118,20 +118,6 @@ extern "C" { # include <machine/param.h> #endif -#ifdef IRIX -# include <sys/endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# undef _BIG_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == BIG_ENDIAN -# undef _LITTLE_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == PDP_ENDIAN -# undef _LITTLE_ENDIAN -# undef _BIG_ENDIAN -# endif -#endif - #ifdef _WIN16 # define _LITTLE_ENDIAN #endif @@ -166,8 +152,7 @@ extern "C" { #if !defined(_WIN32) && !defined(_WIN16) && !defined(OS2) && \ !defined(LINUX) && !defined(NETBSD) && !defined(SCO) && \ !defined(AIX) && !defined(HPUX) && \ - !defined(SOLARIS) && !defined(IRIX) && \ - !defined(MACOSX) && !defined(FREEBSD) + !defined(SOLARIS) && !defined(MACOSX) && !defined(FREEBSD) # error "Target platform not specified !" #endif diff --git a/sal/inc/osl/thread.hxx b/sal/inc/osl/thread.hxx index 0df24e07587a..b770120c167e 100644 --- a/sal/inc/osl/thread.hxx +++ b/sal/inc/osl/thread.hxx @@ -117,7 +117,7 @@ public: osl_joinWithThread(m_hThread); } - sal_Bool SAL_CALL isRunning() + sal_Bool SAL_CALL isRunning() const { return osl_isThreadRunning(m_hThread); } @@ -128,7 +128,7 @@ public: osl_setThreadPriority(m_hThread, Priority); } - oslThreadPriority SAL_CALL getPriority() + oslThreadPriority SAL_CALL getPriority() const { return m_hThread ? osl_getThreadPriority(m_hThread) : osl_Thread_PriorityUnknown; } diff --git a/sal/inc/rtl/math.hxx b/sal/inc/rtl/math.hxx index 5760340cc6a4..4891b7565647 100644 --- a/sal/inc/rtl/math.hxx +++ b/sal/inc/rtl/math.hxx @@ -357,17 +357,28 @@ inline bool isSignBitSet(double d) */ inline void setInf(double * pd, bool bNegative) { - reinterpret_cast< sal_math_Double * >(pd)->w32_parts.msw - = bNegative ? 0xFFF00000 : 0x7FF00000; - reinterpret_cast< sal_math_Double * >(pd)->w32_parts.lsw = 0; + union + { + double sd; + sal_math_Double md; + }; + md.w32_parts.msw = bNegative ? 0xFFF00000 : 0x7FF00000; + md.w32_parts.lsw = 0; + *pd = sd; } /** Set a QNAN. */ inline void setNan(double * pd) { - reinterpret_cast< sal_math_Double * >(pd)->w32_parts.msw = 0x7FFFFFFF; - reinterpret_cast< sal_math_Double * >(pd)->w32_parts.lsw = 0xFFFFFFFF; + union + { + double sd; + sal_math_Double md; + }; + md.w32_parts.msw = 0x7FFFFFFF; + md.w32_parts.lsw = 0xFFFFFFFF; + *pd = sd; } /** If a value is a valid argument for sin(), cos(), tan(). diff --git a/sal/inc/rtl/uuid.h b/sal/inc/rtl/uuid.h index 6451ac7738d6..76911dd841fb 100644 --- a/sal/inc/rtl/uuid.h +++ b/sal/inc/rtl/uuid.h @@ -201,8 +201,6 @@ void SAL_CALL rtl_createNamedUuid( #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10 #elif MACOSX #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 100000 -#elif IRIX -#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 703027277f18..912e58eff06e 100644 --- a/sal/inc/sal/alloca.h +++ b/sal/inc/sal/alloca.h @@ -31,7 +31,7 @@ #ifndef INCLUDED_SAL_ALLOCA_H #define INCLUDED_SAL_ALLOCA_H -#if defined (SOLARIS) || defined (LINUX) || defined (IRIX) || defined(__EMX__) +#if defined (SOLARIS) || defined (LINUX) || defined(__EMX__) #ifndef INCLUDED_ALLOCA_H #include <alloca.h> diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h index f16165fe72cb..c9d31a437758 100644 --- a/sal/inc/sal/config.h +++ b/sal/inc/sal/config.h @@ -102,7 +102,7 @@ extern "C" { #define SAL_SYSCONFIGFILE( name ) name ".ini" #endif -#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(SCO) || defined(IRIX) +#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(SCO) #define SAL_UNX #define SAL_DLLEXTENSION ".so" #define SAL_DLLPREFIX "lib" diff --git a/sal/osl/os2/file.cxx b/sal/osl/os2/file.cxx index e89ce6450bee..f3c1ad015de0 100644 --- a/sal/osl/os2/file.cxx +++ b/sal/osl/os2/file.cxx @@ -2343,7 +2343,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle) # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type)) #endif /* LINUX */ -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) # define __OSL_STATFS_STRUCT struct statvfs # define __OSL_STATFS(dir, sfs) statvfs((dir), (sfs)) # define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize)) @@ -2355,7 +2355,7 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle) of the target platforms fix it!!!! */ # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1) -#endif /* SOLARIS || IRIX*/ +#endif /* SOLARIS */ # define __OSL_STATFS_INIT(a) (memset(&(a), 0, sizeof(__OSL_STATFS_STRUCT))) diff --git a/sal/osl/os2/nlsupport.c b/sal/osl/os2/nlsupport.c index 0efccaa787e6..b05332bab0ea 100644 --- a/sal/osl/os2/nlsupport.c +++ b/sal/osl/os2/nlsupport.c @@ -411,9 +411,6 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) int _imp_setProcessLocale( rtl_Locale * pLocale ) { -#ifdef IRIX - char env_buf[80]; -#endif char locale_buf[64]; /* convert rtl_Locale to locale string */ @@ -421,11 +418,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) { /* only change env vars that exist already */ if( getenv( "LC_ALL" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LC_ALL=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) setenv( "LC_ALL", locale_buf, 1); #else setenv( "LC_ALL", locale_buf ); @@ -433,11 +426,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LC_CTYPE" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LC_CTYPE=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LC_CTYPE", locale_buf ); @@ -445,11 +434,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LANG" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LANG=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined( __EMX__ ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LANG", locale_buf ); diff --git a/sal/osl/os2/socket.c b/sal/osl/os2/socket.c index de70e5b8885a..1c6603b55932 100644 --- a/sal/osl/os2/socket.c +++ b/sal/osl/os2/socket.c @@ -48,7 +48,7 @@ #undef HAVE_POLL_H #endif -#if defined(LINUX) || defined (IRIX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX) +#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX) #include <sys/poll.h> #define HAVE_POLL_H #endif /* HAVE_POLL_H */ diff --git a/sal/osl/os2/system.h b/sal/osl/os2/system.h index 565dfe3ea9c6..ef7626e9c036 100644 --- a/sal/osl/os2/system.h +++ b/sal/osl/os2/system.h @@ -306,36 +306,6 @@ extern unsigned int nanosleep(unsigned int); # define PTHREAD_SIGACTION cma_sigaction #endif -#ifdef IRIX -# define AF_IPX -1 -# include <pthread.h> -# include <semaphore.h> -# include <sched.h> -# include <sys/socket.h> -# include <sys/un.h> -# include <sys/stropts.h> -# include <netinet/tcp.h> -# include <procfs/procfs.h> -# include <sys/endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# undef _BIG_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == BIG_ENDIAN -# undef _LITTLE_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == PDP_ENDIAN -# undef _LITTLE_ENDIAN -# undef _BIG_ENDIAN -# endif -# define SA_FAMILY_DECL \ - union { struct { short sa_family2; } sa_generic; } sa_union -# define PTR_SIZE_T(s) ((int *)&(s)) -# define NO_PTHREAD_PRIORITY -# include <dlfcn.h> -# define IOCHANNEL_TRANSFER_BSD -extern char *strdup(const char *); -#endif - #ifdef SOLARIS # include <shadow.h> # include <sys/procfs.h> @@ -389,7 +359,7 @@ char *macxp_tempnam( const char *tmpdir, const char *prefix ); #if !defined(_WIN32) && !defined(_WIN16) && !defined(OS2) && \ !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && !defined(SCO) && \ !defined(AIX) && !defined(HPUX) && \ - !defined(SOLARIS) && !defined(IRIX) && !defined(MAC) && \ + !defined(SOLARIS) && !defined(MAC) && \ !defined(MACOSX) # error "Target plattform not specified !" #endif diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c index 437d31157049..886da0c3bee5 100755 --- a/sal/osl/unx/backtrace.c +++ b/sal/osl/unx/backtrace.c @@ -207,54 +207,6 @@ void backtrace_symbols_fd( void **buffer, int size, int fd ) } #endif /* defined FREEBSD */ -#if defined(IRIX) -#include <stdio.h> -#include <rld_interface.h> -#include <exception.h> -#include <sys/signal.h> -#include <unistd.h> - -/* Need extra libs -lexc -ldwarf -lelf */ - -int backtrace( void **buffer, int max_frames ) -{ - struct sigcontext context; - int i = 0; - - memset(&context, 0, sizeof(struct sigcontext)); - - exc_setjmp(&context); - while(context.sc_pc != 1 && i < max_frames) { - exc_unwind(&context, 0); - if(context.sc_pc != 1) { - *(buffer++) = (void *)context.sc_pc; - i++; - } - } - return(i); -} - -void backtrace_symbols_fd( void **buffer, int size, int fd ) -{ - FILE *fp = fdopen( fd, "w" ); - struct sigcontext context; - char *name; - - if ( fp ) { - while(context.sc_pc!=1) { - if(context.sc_pc != 1) { - exc_unwind_name(&context, 0, &name); - fprintf(fp, " 0x%012lx %.100s\n", context.sc_pc, name ? name : "<unknown function>"); - free(name); - } - } - - fflush( fp ); - fclose( fp ); - } -} -#endif /* defined IRIX */ - #ifdef LINUX #ifndef _GNU_SOURCE diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index b9b2b6a23c7d..0bde1616f6ae 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -1013,6 +1013,15 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD return nRet; } + /* HACK: because memory mapping fails on various + platforms if the size of the source file is 0 byte */ + if (0 == nSourceSize) + { + close(SourceFileFD); + close(DestFileFD); + return 0; + } + // read and lseek are used to check the possibility to access the data // not a nice solution, but it allows to avoid a crash in case it is an opened samba file // generally, reading of one byte should not affect the performance @@ -1034,15 +1043,6 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD return nRet; } - /* HACK: because memory mapping fails on various - platforms if the size of the source file is 0 byte */ - if (0 == nSourceSize) - { - close(SourceFileFD); - close(DestFileFD); - return 0; - } - size_t nWritten = 0; size_t nRemains = nSourceSize; diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index a3b7109123b7..4489368a4c9b 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -76,16 +76,6 @@ static const sal_Char* MOUNTTAB="/etc/mtab"; * This information is stored only in the kernel. */ /* static const sal_Char* MOUNTTAB="/etc/mtab"; */ -#elif defined(IRIX) - -#include <mntent.h> -#include <sys/mount.h> -#include <sys/statvfs.h> -#define HAVE_STATFS_H -#include <sys/quota.h> -//#include <ctype.h> -static const sal_Char* MOUNTTAB="/etc/mtab"; - #elif defined(MACOSX) #include <ufs/ufs/quota.h> @@ -140,12 +130,6 @@ static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice); static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem); #endif /* LINUX */ - -#if defined(IRIX) -static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice); -static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem); -#endif /* IRIX */ - #ifdef DEBUG_OSL_FILE static void osl_printFloppyHandle(oslVolumeDeviceHandleImpl* hFloppy); #endif /* DEBUG_OSL_FILE */ @@ -220,7 +204,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) ((__OSL_MSDOS_SUPER_MAGIC != (a).f_type)) #endif /* LINUX */ -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) # define __OSL_STATFS_STRUCT struct statvfs # define __OSL_STATFS(dir, sfs) statvfs((dir), (sfs)) # define __OSL_STATFS_BLKSIZ(a) ((sal_uInt64)((a).f_frsize)) @@ -232,7 +216,7 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI of the target platforms fix it!!!! */ # define __OSL_STATFS_IS_CASE_SENSITIVE_FS(a) (1) # define __OSL_STATFS_IS_CASE_PRESERVING_FS(a) (1) -#endif /* SOLARIS || IRIX*/ +#endif /* SOLARIS */ # define __OSL_STATFS_INIT(a) (memset(&(a), 0, sizeof(__OSL_STATFS_STRUCT))) @@ -1093,411 +1077,6 @@ osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice) } #endif /* LINUX */ -/****************************************************************************** - * - * IRIX FLOPPY FUNCTIONS - * - *****************************************************************************/ - -#if defined(IRIX) -static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath) -{ - oslVolumeDeviceHandleImpl* pItem = osl_newVolumeDeviceHandleImpl (); - sal_Bool bRet = sal_False; - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"In osl_isFloppyDrive\n"); -#endif - - bRet=osl_getFloppyMountEntry(pszPath,pItem); - - if ( bRet == sal_False ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_isFloppyDrive [not a floppy]\n"); -#endif - rtl_freeMemory(pItem); - return 0; - } - - -#ifdef DEBUG_OSL_FILE - osl_printFloppyHandle(pItem); -#endif -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_isFloppyDrive [ok]\n"); -#endif - - return (oslVolumeDeviceHandle) pItem; -} - - -static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy) -{ - sal_Bool bRet = sal_False; - oslVolumeDeviceHandleImpl* pItem=0; - int nRet; - sal_Char pszCmd[PATH_MAX]; - sal_Char* pszMountProg = "mount"; - sal_Char* pszSuDo = 0; - sal_Char* pszTmp = 0; - - pszCmd[0] = '\0'; - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"In osl_mountFloppy\n"); -#endif - - pItem = (oslVolumeDeviceHandleImpl*) hFloppy; - - if ( pItem == 0 ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_mountFloppy [pItem == 0]\n"); -#endif - - return osl_File_E_INVAL; - } - - if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_mountFloppy [invalid handle]\n"); -#endif - return osl_File_E_INVAL; - } - - bRet = osl_isFloppyMounted(pItem); - if ( bRet == sal_True ) - { -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"detected mounted floppy at '%s'\n",pItem->pszMountPoint); -#endif - return osl_File_E_BUSY; - } - - /* mfe: we can't use the mount(2) system call!!! */ - /* even if we are root */ - /* since mtab is not updated!!! */ - /* but we need it to be updated */ - /* some "magic" must be done */ - -/* nRet = mount(pItem->pszDevice,pItem->pszMountPoint,0,0,0); */ -/* if ( nRet != 0 ) */ -/* { */ -/* nRet=errno; */ -/* #ifdef DEBUG_OSL_FILE */ -/* perror("mount"); */ -/* #endif */ -/* } */ - - pszTmp = getenv("SAL_MOUNT_MOUNTPROG"); - if ( pszTmp != 0 ) - { - pszMountProg=pszTmp; - } - - pszTmp=getenv("SAL_MOUNT_SU_DO"); - if ( pszTmp != 0 ) - { - pszSuDo=pszTmp; - } - - if ( pszSuDo != 0 ) - { - snprintf(pszCmd, sizeof(pszCmd), "%s %s %s %s",pszSuDo,pszMountProg,pItem->pszDevice,pItem->pszMountPoint); - } - else - { - snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszMountProg,pItem->pszMountPoint); - } - - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"executing '%s'\n",pszCmd); -#endif - - nRet = system(pszCmd); - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"call returned '%i'\n",nRet); - fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet)); -#endif - - - switch ( WEXITSTATUS(nRet) ) - { - case 0: - nRet=0; - break; - - case 2: - nRet=EPERM; - break; - - case 4: - nRet=ENOENT; - break; - - case 8: - nRet=EINTR; - break; - - case 16: - nRet=EPERM; - break; - - case 32: - nRet=EBUSY; - break; - - case 64: - nRet=EAGAIN; - break; - - default: - nRet=EBUSY; - break; - } - - return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet)); -} - -static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy) -{ - oslVolumeDeviceHandleImpl* pItem=0; - int nRet=0; - sal_Char pszCmd[PATH_MAX]; - sal_Char* pszTmp = 0; - sal_Char* pszSuDo = 0; - sal_Char* pszUmountProg = "umount"; - - pszCmd[0] = '\0'; - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"In osl_unmountFloppy\n"); -#endif - - pItem = (oslVolumeDeviceHandleImpl*) hFloppy; - - if ( pItem == 0 ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_unmountFloppy [pItem==0]\n"); -#endif - return osl_File_E_INVAL; - } - - if ( pItem->ident[0] != 'O' || pItem->ident[1] != 'V' || pItem->ident[2] != 'D' || pItem->ident[3] != 'H' ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_unmountFloppy [invalid handle]\n"); -#endif - return osl_File_E_INVAL; - } - - /* mfe: we can't use the umount(2) system call!!! */ - /* even if we are root */ - /* since mtab is not updated!!! */ - /* but we need it to be updated */ - /* some "magic" must be done */ - -/* nRet=umount(pItem->pszDevice); */ -/* if ( nRet != 0 ) */ -/* { */ -/* nRet = errno; */ - -/* #ifdef DEBUG_OSL_FILE */ -/* perror("mount"); */ -/* #endif */ -/* } */ - - - pszTmp = getenv("SAL_MOUNT_UMOUNTPROG"); - if ( pszTmp != 0 ) - { - pszUmountProg=pszTmp; - } - - pszTmp = getenv("SAL_MOUNT_SU_DO"); - if ( pszTmp != 0 ) - { - pszSuDo=pszTmp; - } - - if ( pszSuDo != 0 ) - { - snprintf(pszCmd, sizeof(pszCmd), "%s %s %s",pszSuDo,pszUmountProg,pItem->pszMountPoint); - } - else - { - snprintf(pszCmd, sizeof(pszCmd), "%s %s",pszUmountProg,pItem->pszMountPoint); - } - - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"executing '%s'\n",pszCmd); -#endif - - nRet = system(pszCmd); - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"call returned '%i'\n",nRet); - fprintf(stderr,"exit status is '%i'\n", WEXITSTATUS(nRet)); -#endif - - switch ( WEXITSTATUS(nRet) ) - { - case 0: - nRet=0; - break; - - default: - nRet=EBUSY; - break; - } - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_unmountFloppy [ok]\n"); -#endif - - return ((0 == nRet) ? oslTranslateFileError(OSL_FET_SUCCESS, nRet) : oslTranslateFileError(OSL_FET_ERROR, nRet)); - -/* return osl_File_E_None;*/ -} - -static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem) -{ - struct mntent* pMountEnt=0; - sal_Char buffer[PATH_MAX]; - FILE* mntfile=0; - int nRet=0; - - buffer[0] = '\0'; - - mntfile = setmntent(MOUNTTAB,"r"); - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"In osl_getFloppyMountEntry\n"); -#endif - - memset(buffer, 0, sizeof(buffer)); - strncpy(buffer, pszPath, sizeof(buffer) - 1); - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"Checking mount of %s\n",buffer); -#endif - - - if ( mntfile == 0 ) - { - nRet=errno; -#ifdef DEBUG_OSL_FILE - perror("mounttab"); -#endif -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_getFloppyMountEntry [mntfile]\n"); -#endif - return sal_False; - } - - pMountEnt=getmntent(mntfile); - while ( pMountEnt != 0 ) - { -#ifdef DEBUG_OSL_FILE -/* fprintf(stderr,"mnt_fsname : %s\n",pMountEnt->mnt_fsname); */ -/* fprintf(stderr,"mnt_dir : %s\n",pMountEnt->mnt_dir); */ -/* fprintf(stderr,"mnt_type : %s\n",pMountEnt->mnt_type);*/ -#endif - if ( strcmp(pMountEnt->mnt_dir,buffer) == 0 && - strncmp(pMountEnt->mnt_fsname,"/dev/fd",strlen("/dev/fd")) == 0 ) - { - - memset(pItem->pszMountPoint, 0, sizeof(pItem->pszMountPoint)); - strncpy(pItem->pszMountPoint, pMountEnt->mnt_dir, sizeof(pItem->pszMountPoint) - 1); - - memset(pItem->pszFilePath, 0, sizeof(pItem->pszFilePath)); - strncpy(pItem->pszFilePath, pMountEnt->mnt_dir, sizeof(pItem->pszFilePath) - 1); - - memset(pItem->pszDevice, 0, sizeof(pItem->pszDevice)); - strncpy(pItem->pszDevice, pMountEnt->mnt_fsname, sizeof(pItem->pszDevice) - 1); - - fclose(mntfile); -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"Mount Point found '%s'\n",pItem->pszMountPoint); -#endif -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_getFloppyMountEntry [found]\n"); -#endif - return sal_True; - } -#ifdef DEBUG_OSL_FILE -/* fprintf(stderr,"=================\n");*/ -#endif - pMountEnt=getmntent(mntfile); - } - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_getFloppyMountEntry [not found]\n"); -#endif - - fclose(mntfile); - return sal_False; -} - -static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice) -{ - sal_Char buffer[PATH_MAX]; - oslVolumeDeviceHandleImpl* pItem=0; - sal_Bool bRet=0; - - buffer[0] = '\0'; - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"In osl_isFloppyMounted\n"); -#endif - - pItem = osl_newVolumeDeviceHandleImpl (); - if ( pItem == 0 ) - return osl_File_E_NOMEM; - - memset(buffer, 0, sizeof(buffer)); - strncpy(buffer, pDevice->pszMountPoint, sizeof(buffer) - 1); - -#ifdef DEBUG_OSL_FILE - fprintf(stderr,"Checking mount of %s\n",buffer); -#endif - - bRet = osl_getFloppyMountEntry(buffer,pItem); - - if ( bRet == sal_False ) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_isFloppyMounted [not mounted]\n"); -#endif - return sal_False; - } - - if (strcmp(pItem->pszMountPoint, pDevice->pszMountPoint) == 0 && - strcmp(pItem->pszDevice,pDevice->pszDevice) == 0) - { -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_isFloppyMounted [is mounted]\n"); -#endif - rtl_freeMemory(pItem); - return sal_True; - } - -#ifdef TRACE_OSL_FILE - fprintf(stderr,"Out osl_isFloppyMounted [may be EBUSY]\n"); -#endif - - rtl_freeMemory(pItem); - return sal_False; -} -#endif /* IRIX */ - - /* NetBSD floppy functions have to be added here. Until we have done that, * we use the MACOSX definitions for nonexistent floppy. * */ diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index d486aad00e01..ffb0ebb61e7b 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -35,32 +35,6 @@ #include <osl/process.h> #include <osl/file.h> -#ifdef IRIX -#ifndef _RLD_INTERFACE_DLFCN_H_DLADDR -#define _RLD_INTERFACE_DLFCN_H_DLADDR -typedef struct DL_INFO { - const char * dli_fname; - void * dli_fbase; - const char * dli_sname; - void * dli_saddr; - int dli_version; - int dli_reserved1; - long dli_reserved[4]; -} Dl_info; -#endif -#include <rld_interface.h> -#define _RLD_DLADDR 14 -int dladdr(void *address, Dl_info *dl); - -int dladdr(void *address, Dl_info *dl) -{ - void *v; - v = _rld_new_interface(_RLD_DLADDR,address,dl); - - return (int)v; -} -#endif - #include "system.h" #if OSL_DEBUG_LEVEL > 1 diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c index e5390089e6d7..5f3741be883e 100644 --- a/sal/osl/unx/nlsupport.c +++ b/sal/osl/unx/nlsupport.c @@ -33,7 +33,7 @@ #include <osl/process.h> #include <rtl/memory.h> -#if defined(LINUX) || defined(SOLARIS) || defined(IRIX) || defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) +#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) #include <pthread.h> #ifndef MACOSX #include <locale.h> @@ -42,7 +42,7 @@ #include <osl/module.h> #include <osl/thread.h> #endif /* !MACOSX */ -#endif /* LINUX || SOLARIS || IRIX || NETBSD || MACOSX */ +#endif /* LINUX || SOLARIS || NETBSD || MACOSX */ #include <string.h> @@ -229,13 +229,12 @@ static rtl_Locale * _parse_locale( const char * locale ) return NULL; } -#if defined(LINUX) || defined(SOLARIS) || defined(IRIX) || defined(NETBSD) || defined(FREEBSD) +#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) /* * This implementation of osl_getTextEncodingFromLocale maps * from nl_langinfo(CODESET) to rtl_textencoding defines. - * nl_langinfo() is supported only on Linux and Solaris. - * nl_langinfo() is supported only on Linux, Solaris and IRIX, + * nl_langinfo() is supported only on Linux, Solaris, * >= NetBSD 1.6 and >= FreeBSD 4.4 * * This routine is SLOW because of the setlocale call, so @@ -299,24 +298,6 @@ const _pair _nl_language_list[] = { /* XXX MS-874 is an extension to tis620, so this is not * really equivalent */ -#elif defined(IRIX) - -const _pair _nl_language_list[] = { - { "big5", RTL_TEXTENCODING_BIG5 }, /* China - Traditional Chinese */ - { "eucCN", RTL_TEXTENCODING_EUC_CN }, /* China */ - { "eucgbk", RTL_TEXTENCODING_DONTKNOW }, /* China - Simplified Chinese */ - { "eucJP", RTL_TEXTENCODING_EUC_JP }, /* Japan */ - { "eucKR", RTL_TEXTENCODING_EUC_KR }, /* Korea */ - { "eucTW", RTL_TEXTENCODING_EUC_TW }, /* Taiwan - Traditional Chinese */ - { "gbk", RTL_TEXTENCODING_GBK }, /* China - Simplified Chinese */ - { "ISO8859-1", RTL_TEXTENCODING_ISO_8859_1 }, /* Western */ - { "ISO8859-2", RTL_TEXTENCODING_ISO_8859_2 }, /* Central European */ - { "ISO8859-5", RTL_TEXTENCODING_ISO_8859_5 }, /* Cyrillic */ - { "ISO8859-7", RTL_TEXTENCODING_ISO_8859_7 }, /* Greek */ - { "ISO8859-9", RTL_TEXTENCODING_ISO_8859_9 }, /* Turkish */ - { "ISO8859-15", RTL_TEXTENCODING_ISO_8859_15 }, /* Western Updated (w/Euro sign) */ - { "sjis", RTL_TEXTENCODING_SHIFT_JIS } /* Japan */ -}; #elif defined(LINUX) || defined(NETBSD) @@ -552,7 +533,7 @@ const _pair _nl_language_list[] = { { "UTF-8", RTL_TEXTENCODING_UTF8 } /* ISO-10646/UTF-8 */ }; -#endif /* ifdef SOLARIS IRIX LINUX FREEBSD NETBSD */ +#endif /* ifdef SOLARIS LINUX FREEBSD NETBSD */ static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER; @@ -927,9 +908,6 @@ void _imp_getProcessLocale( rtl_Locale ** ppLocale ) int _imp_setProcessLocale( rtl_Locale * pLocale ) { -#ifdef IRIX - char env_buf[80]; -#endif char locale_buf[64]; /* convert rtl_Locale to locale string */ @@ -937,11 +915,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) { /* only change env vars that exist already */ if( getenv( "LC_ALL" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LC_ALL=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) setenv( "LC_ALL", locale_buf, 1); #else setenv( "LC_ALL", locale_buf ); @@ -949,11 +923,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LC_CTYPE" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LC_CTYPE=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LC_CTYPE", locale_buf ); @@ -961,11 +931,7 @@ int _imp_setProcessLocale( rtl_Locale * pLocale ) } if( getenv( "LANG" ) ) { -#if defined( IRIX ) - snprintf(env_buf, sizeof(env_buf), "LANG=%s", locale_buf); - env_buf[sizeof(env_buf)] = '\0'; - putenv(env_buf); -#elif defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) +#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) setenv("LC_CTYPE", locale_buf, 1 ); #else setenv( "LANG", locale_buf ); diff --git a/sal/osl/unx/process.c b/sal/osl/unx/process.c index a1f47cdf76a5..e3f78ff2f2b4 100644 --- a/sal/osl/unx/process.c +++ b/sal/osl/unx/process.c @@ -49,7 +49,7 @@ #endif #include "system.h" -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) # include <sys/procfs.h> #endif #include <osl/diagnose.h> @@ -269,7 +269,7 @@ static sal_Bool sendFdPipe(int PipeFD, int SocketFD) cmptr->cmsg_level = SOL_SOCKET; cmptr->cmsg_type = SCM_RIGHTS; cmptr->cmsg_len = CONTROLLEN; - *(int*)CMSG_DATA(cmptr) = SocketFD; + memcpy(CMSG_DATA(cmptr), &SocketFD, sizeof(int)); #endif @@ -360,7 +360,7 @@ static oslSocket receiveFdPipe(int PipeFD) ( msghdr.msg_controllen == CONTROLLEN ) ) { OSL_TRACE("receiveFdPipe : received '%i' bytes\n",nRead); - newfd = *(int*)CMSG_DATA(cmptr); + memcpy(&newfd, CMSG_DATA(cmptr), sizeof(int)); } #endif else @@ -431,10 +431,8 @@ oslSocket osl_receiveResourcePipe(oslPipe pPipe) static void ChildStatusProc(void *pData) { - int i; -/* int first = 0;*/ - pid_t pid; -/* int status;*/ + pid_t pid = -1; + int status = 0; int channel[2]; ProcessData data; ProcessData *pdata; @@ -447,25 +445,31 @@ static void ChildStatusProc(void *pData) in our child process */ memcpy(&data, pData, sizeof(data)); - socketpair(AF_UNIX, SOCK_STREAM, 0, channel); + if (socketpair(AF_UNIX, SOCK_STREAM, 0, channel) == -1) + status = errno; fcntl(channel[0], F_SETFD, FD_CLOEXEC); fcntl(channel[1], F_SETFD, FD_CLOEXEC); /* Create redirected IO pipes */ + if ( status == 0 && data.m_pInputWrite ) + if (pipe( stdInput ) == -1) + status = errno; - if ( data.m_pInputWrite ) - pipe( stdInput ); - - if ( data.m_pOutputRead ) - pipe( stdOutput ); + if ( status == 0 && data.m_pOutputRead ) + if (pipe( stdOutput ) == -1) + status = errno; - if ( data.m_pErrorRead ) - pipe( stdError ); + if ( status == 0 && data.m_pErrorRead ) + if (pipe( stdError ) == -1) + status = errno; - if ((pid = fork()) == 0) + if ( (status == 0) && ((pid = fork()) == 0) ) { /* Child */ + int chstatus = 0; + sal_Int32 nWrote; + if (channel[0] != -1) close(channel[0]); if ((data.m_uid != (uid_t)-1) && ((data.m_uid != getuid()) || (data.m_gid != getgid()))) @@ -481,20 +485,15 @@ static void ChildStatusProc(void *pData) #endif } - if ((data.m_uid == (uid_t)-1) || ((data.m_uid == getuid()) && (data.m_gid == getgid()))) + if (data.m_pszDir) + chstatus = chdir(data.m_pszDir); + if (chstatus == 0 && ((data.m_uid == (uid_t)-1) || ((data.m_uid == getuid()) && (data.m_gid == getgid())))) { - if (data.m_pszDir) - chdir(data.m_pszDir); - + int i; for (i = 0; data.m_pszEnv[i] != NULL; i++) putenv(data.m_pszEnv[i]); -#if defined(LINUX) && !defined(NPTL) - /* mfe: linux likes to have just one thread when the exec family is called */ - /* this np function has this purpose ... */ - pthread_kill_other_threads_np(); -#endif OSL_TRACE("ChildStatusProc : starting '%s'",data.m_pszArgs[0]); /* Connect std IO to pipe ends */ @@ -537,7 +536,9 @@ static void ChildStatusProc(void *pData) OSL_TRACE("ChildStatusProc : starting '%s' failed",data.m_pszArgs[0]); /* if we reach here, something went wrong */ - write(channel[1], &errno, sizeof(errno)); + nWrote = write(channel[1], &errno, sizeof(errno)); + if (nWrote != sizeof(errno)) + OSL_TRACE("sendFdPipe : sending failed (%s)",strerror(errno)); if (channel[1] != -1) close(channel[1]); @@ -545,8 +546,7 @@ static void ChildStatusProc(void *pData) } else { /* Parent */ - int status; - + int i = -1; if (channel[1] != -1) close(channel[1]); /* Close unused pipe ends */ @@ -554,15 +554,17 @@ static void ChildStatusProc(void *pData) if (stdOutput[1] != -1) close( stdOutput[1] ); if (stdError[1] != -1) close( stdError[1] ); - while (((i = read(channel[0], &status, sizeof(status))) < 0)) + if (pid > 0) { - if (errno != EINTR) - break; + while (((i = read(channel[0], &status, sizeof(status))) < 0)) + { + if (errno != EINTR) + break; + } } if (channel[0] != -1) close(channel[0]); - if ((pid > 0) && (i == 0)) { pid_t child_pid; @@ -1368,48 +1370,6 @@ oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData F return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown; } -#elif defined(IRIX) - - int fd; - sal_Char name[PATH_MAX + 1]; - - snprintf(name, sizeof(name), "/proc/%u", pid); - - if ((fd = open(name, O_RDONLY)) >= 0) - { - prstatus_t prstatus; - prpsinfo_t prpsinfo; - - if (ioctl(fd, PIOCSTATUS, &prstatus) >= 0 && - ioctl(fd, PIOCPSINFO, &prpsinfo) >= 0) - { - if (Fields & osl_Process_CPUTIMES) - { - pInfo->UserTime.Seconds = prstatus.pr_utime.tv_sec; - pInfo->UserTime.Nanosec = prstatus.pr_utime.tv_nsec; - pInfo->SystemTime.Seconds = prstatus.pr_stime.tv_sec; - pInfo->SystemTime.Nanosec = prstatus.pr_stime.tv_nsec; - - pInfo->Fields |= osl_Process_CPUTIMES; - } - - if (Fields & osl_Process_HEAPUSAGE) - { - int pagesize = getpagesize(); - - pInfo->HeapUsage = prpsinfo.pr_size*pagesize; - - pInfo->Fields |= osl_Process_HEAPUSAGE; - } - - close(fd); - - return (pInfo->Fields == Fields) ? osl_Process_E_None : osl_Process_E_Unknown; - } - else - close(fd); - } - #elif defined(LINUX) if ( (Fields & osl_Process_CPUTIMES) || (Fields & osl_Process_HEAPUSAGE) ) diff --git a/sal/osl/unx/profile.c b/sal/osl/unx/profile.c index a01d292e23b6..a0ea4c59ffdd 100644 --- a/sal/osl/unx/profile.c +++ b/sal/osl/unx/profile.c @@ -263,12 +263,9 @@ static oslProfile SAL_CALL osl_psz_openProfile(const sal_Char *pszProfileName, o pProfile->m_Stamp = OslProfile_getFileStamp(pFile); bRet=loadProfile(pFile, pProfile); + bRet &= realpath(pszProfileName, pProfile->m_FileName) != NULL; OSL_ASSERT(bRet); - /* #109261# using osl profiles is deprecated */ - /* OSL_VERIFY(NULL != realpath(pszProfileName, pProfile->m_FileName)); */ - realpath(pszProfileName, pProfile->m_FileName); - if (pProfile->m_pFile == NULL) closeFileImpl(pFile,pProfile->m_Flags); @@ -1338,6 +1335,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags) static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate) { + sal_Bool bRet = sal_True; #ifdef TRACE_OSL_PROFILE OSL_TRACE("In osl_OslProfile_rewindFile\n"); #endif @@ -1349,14 +1347,14 @@ static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate) #ifdef DEBUG_OSL_PROFILE OSL_TRACE("rewinding\n"); #endif - lseek(pFile->m_Handle, SEEK_SET, 0L); + bRet = (lseek(pFile->m_Handle, SEEK_SET, 0L) == 0L); if (bTruncate) { #ifdef DEBUG_OSL_PROFILE OSL_TRACE("truncating\n"); #endif - ftruncate(pFile->m_Handle, 0L); + bRet &= (ftruncate(pFile->m_Handle, 0L) == 0); } } @@ -1364,7 +1362,7 @@ static sal_Bool OslProfile_rewindFile(osl_TFile* pFile, sal_Bool bTruncate) #ifdef TRACE_OSL_PROFILE OSL_TRACE("Out osl_OslProfile_rewindFile [ok]\n"); #endif - return (sal_True); + return bRet; } diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c index 310dd57592f5..362f3b0f2644 100644 --- a/sal/osl/unx/socket.c +++ b/sal/osl/unx/socket.c @@ -48,7 +48,7 @@ #undef HAVE_POLL_H #endif -#if defined(LINUX) || defined (IRIX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX) +#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX) #include <sys/poll.h> #define HAVE_POLL_H #endif /* HAVE_POLL_H */ @@ -1869,10 +1869,13 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) if ( pSocket->m_bIsAccepting == sal_True ) { int nConnFD; - struct sockaddr aSockAddr; - socklen_t nSockLen = sizeof(aSockAddr); + union { + struct sockaddr aSockAddr; + struct sockaddr_in aSockAddrIn; + } s; + socklen_t nSockLen = sizeof(s.aSockAddr); - nRet = getsockname(nFD, &aSockAddr, &nSockLen); + nRet = getsockname(nFD, &s.aSockAddr, &nSockLen); #if OSL_DEBUG_LEVEL > 1 if ( nRet < 0 ) { @@ -1880,13 +1883,11 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) } #endif /* OSL_DEBUG_LEVEL */ - if ( aSockAddr.sa_family == AF_INET ) + if ( s.aSockAddr.sa_family == AF_INET ) { - struct sockaddr_in* pSockAddrIn = (struct sockaddr_in*) &aSockAddr; - - if ( pSockAddrIn->sin_addr.s_addr == htonl(INADDR_ANY) ) + if ( s.aSockAddrIn.sin_addr.s_addr == htonl(INADDR_ANY) ) { - pSockAddrIn->sin_addr.s_addr = htonl(INADDR_LOOPBACK); + s.aSockAddrIn.sin_addr.s_addr = htonl(INADDR_LOOPBACK); } nConnFD = socket(AF_INET, SOCK_STREAM, 0); @@ -1897,7 +1898,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket) } #endif /* OSL_DEBUG_LEVEL */ - nRet = connect(nConnFD, &aSockAddr, sizeof(aSockAddr)); + nRet = connect(nConnFD, &s.aSockAddr, sizeof(s.aSockAddr)); #if OSL_DEBUG_LEVEL > 1 if ( nRet < 0 ) { diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h index c2e01126fb58..91f3b9fb7ae0 100644 --- a/sal/osl/unx/system.h +++ b/sal/osl/unx/system.h @@ -270,34 +270,6 @@ extern unsigned int nanosleep(unsigned int); # define PTHREAD_SIGACTION cma_sigaction #endif -#ifdef IRIX -# define AF_IPX -1 -# include <pthread.h> -# include <semaphore.h> -# include <sched.h> -# include <sys/socket.h> -# include <sys/un.h> -# include <sys/stropts.h> -# include <netinet/tcp.h> -# include <sys/endian.h> -# if BYTE_ORDER == LITTLE_ENDIAN -# undef _BIG_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == BIG_ENDIAN -# undef _LITTLE_ENDIAN -# undef _PDP_ENDIAN -# elif BYTE_ORDER == PDP_ENDIAN -# undef _LITTLE_ENDIAN -# undef _BIG_ENDIAN -# endif -# define SA_FAMILY_DECL \ - union { struct { short sa_family2; } sa_generic; } sa_union -# define NO_PTHREAD_PRIORITY -# include <dlfcn.h> -# define IOCHANNEL_TRANSFER_BSD -extern char *strdup(const char *); -#endif - #ifdef SOLARIS # include <shadow.h> # include <sys/un.h> @@ -364,8 +336,7 @@ int macxp_resolveAlias(char *path, int buflen); #if !defined(_WIN32) && !defined(_WIN16) && !defined(OS2) && \ !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) && !defined(SCO) && \ !defined(AIX) && !defined(HPUX) && \ - !defined(SOLARIS) && !defined(IRIX) && \ - !defined(MACOSX) + !defined(SOLARIS) && !defined(MACOSX) # error "Target platform not specified!" #endif diff --git a/sal/rtl/source/alloc.c b/sal/rtl/source/alloc.c index 98a4c061e42b..123406717275 100644 --- a/sal/rtl/source/alloc.c +++ b/sal/rtl/source/alloc.c @@ -78,7 +78,7 @@ static sal_Size __rtl_memory_vmpagesize (void) /* xBSD */ return (sal_Size)(getpagesize()); } -#elif defined(IRIX) || defined(LINUX) || defined(SOLARIS) +#elif defined(LINUX) || defined(SOLARIS) static sal_Size __rtl_memory_vmpagesize (void) { /* POSIX */ @@ -90,7 +90,7 @@ static sal_Size __rtl_memory_vmpagesize (void) /* other */ return (sal_Size)(0x2000); } -#endif /* FREEBSD || NETBSD || MACOSX || IRIX || LINUX || SOLARIS */ +#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS */ #ifndef PROT_HEAP #define PROT_HEAP (PROT_READ | PROT_WRITE | PROT_EXEC) diff --git a/sal/rtl/source/bootstrap.cxx b/sal/rtl/source/bootstrap.cxx index 23dab839d558..769251a6c4ec 100644 --- a/sal/rtl/source/bootstrap.cxx +++ b/sal/rtl/source/bootstrap.cxx @@ -820,8 +820,8 @@ void SAL_CALL rtl_bootstrap_set ( rtl_uString * pValue ) SAL_THROW_EXTERN_C() { - OUString const & name = *reinterpret_cast< OUString const * >( &pName ); - OUString const & value = *reinterpret_cast< OUString const * >( &pValue ); + const OUString name( pName ); + const OUString value( pValue ); osl::MutexGuard guard( osl::Mutex::getGlobalMutex() ); diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx index 2f0b723d236a..ba274844952e 100644 --- a/sal/rtl/source/macro.hxx +++ b/sal/rtl/source/macro.hxx @@ -49,8 +49,6 @@ #define THIS_OS "NetBSD" #elif defined FREEBSD #define THIS_OS "FreeBSD" -#elif defined IRIX -#define THIS_OS "Irix" #endif #if ! defined THIS_OS @@ -76,8 +74,6 @@ this is inserted for the case that the preprocessor ignores error #else # define THIS_ARCH "SPARC" #endif -#elif defined IRIX -# define THIS_ARCH "MIPS" #elif defined MIPS # ifdef OSL_BIGENDIAN # define THIS_ARCH "MIPS_EB" diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx index a255ca21b13a..012046c9e5c8 100644 --- a/sal/rtl/source/math.cxx +++ b/sal/rtl/source/math.cxx @@ -879,8 +879,13 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd, rtl::math::setNan( &fVal ); if (bSign) { - reinterpret_cast< sal_math_Double * >(&fVal)->w32_parts.msw - |= 0x80000000; // create negative NaN + union { + double sd; + sal_math_Double md; + } m; + m.sd = fVal; + m.md.w32_parts.msw |= 0x80000000; // create negative NaN + fVal = m.sd; bSign = false; // don't negate again } // Eat any further digits: diff --git a/sal/util/makefile.mk b/sal/util/makefile.mk index bc8026aa860f..3247be8774de 100644 --- a/sal/util/makefile.mk +++ b/sal/util/makefile.mk @@ -127,9 +127,6 @@ SHL1STDLIBS= -Bdynamic -ldl -lpthread -lposix4 -lsocket -lnsl SHL1STDLIBS+= -z allextract -staticlib=Crun -z defaultextract .ENDIF # C50 .ENDIF # SOLARIS -.IF "$(OS)"=="IRIX" -SHL1STDLIBS= -lexc -.ENDIF .ENDIF # UNX .IF "$(GUI)"=="OS2" @@ -163,6 +160,12 @@ SHL1STDLIBS+=-lcrypt .ENDIF .ENDIF +# #i105898# required for LD_PRELOAD libsalalloc_malloc.so +# if sal is linked with -Bsymbolic-functions +.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)" == "TRUE" +SHL1LINKFLAGS+=-Wl,--dynamic-list=salalloc.list +.ENDIF # .IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)" == "TRUE" + SHL1LIBS+=$(SLB)$/$(TARGET).lib .IF "$(linkinc)" != "" diff --git a/sal/util/salalloc.list b/sal/util/salalloc.list new file mode 100644 index 000000000000..303d225dda7f --- /dev/null +++ b/sal/util/salalloc.list @@ -0,0 +1,7 @@ +{ + rtl_allocateMemory; + rtl_reallocateMemory; + rtl_freeMemory; + rtl_allocateZeroMemory; + rtl_freeZeroMemory; +}; |