[Libreoffice-commits] .: cppu/source cppu/util sal/inc sal/osl sal/rtl sal/workben

Thorsten Behrens thorsten at kemper.freedesktop.org
Thu Nov 4 01:25:48 PDT 2010


 cppu/source/uno/data.cxx          |    6 +++--
 cppu/util/makefile.mk             |    2 -
 sal/inc/osl/endian.h              |    6 ++---
 sal/inc/rtl/uuid.h                |    2 +
 sal/inc/sal/alloca.h              |    2 -
 sal/inc/sal/config.h              |    3 +-
 sal/inc/sal/types.h               |    4 ++-
 sal/osl/unx/backtrace.c           |    2 -
 sal/osl/unx/backtrace.h           |    7 +++---
 sal/osl/unx/file.cxx              |    3 +-
 sal/osl/unx/file_error_transl.cxx |    6 ++---
 sal/osl/unx/file_volume.cxx       |   27 +++++++++++++++----------
 sal/osl/unx/makefile.mk           |    4 ++-
 sal/osl/unx/nlsupport.c           |   41 ++++++++++++++++++++++++++++++++------
 sal/osl/unx/process.c             |    2 -
 sal/osl/unx/socket.c              |    3 +-
 sal/osl/unx/system.h              |   29 +++++++++++++++++++++++++-
 sal/osl/unx/thread.c              |   24 ++++++++++++++++++++++
 sal/osl/unx/time.c                |    3 +-
 sal/rtl/source/alloc.c            |    5 ++--
 sal/rtl/source/macro.hxx          |    2 +
 sal/workben/makefile.mk           |    3 +-
 22 files changed, 145 insertions(+), 41 deletions(-)

New commits:
commit 04ec590fd95650782c3c01a5ada8208a4f5f8686
Author: Robert Nagy <robert at openbsd.org>
Date:   Thu Nov 4 09:25:04 2010 +0100

    Patches for ure, neeed by OpenBSD
    
    Adds the necessary distinctions in the system abstraction layers.

diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx
index 77243fd..5a8de8a 100644
--- a/cppu/source/uno/data.cxx
+++ b/cppu/source/uno/data.cxx
@@ -360,7 +360,8 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData(
 #endif
 
 #if defined(INTEL) \
-    && (defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD) || defined(OS2)) || defined(MACOSX) \
+    && (defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD) || defined(OS2) || \
+	defined(OPENBSD)) || defined(MACOSX) \
         || defined(__SUNPRO_CC) && defined(SOLARIS))
 #define MAX_ALIGNMENT_4
 #endif
@@ -373,7 +374,8 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData(
     if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", "  #m ") = %d instead of expected %d!!!\n", OFFSET_OF(s, m), n ); abort(); }
 
 #if OSL_DEBUG_LEVEL > 1
-#if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD)) && (defined(INTEL) || defined(POWERPC) || defined(X86_64) || defined(S390))
+#if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD) || defined(OPENBSD)) && \
+	(defined(INTEL) || defined(POWERPC) || defined(X86_64) || defined(S390))
 #define BINTEST_VERIFYSIZE( s, n ) \
     fprintf( stderr, "> sizeof(" #s ") = %d; __alignof__ (" #s ") = %d\n", sizeof(s), __alignof__ (s) ); \
     if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %d instead of expected %d!!!\n", sizeof(s), n ); abort(); }
diff --git a/cppu/util/makefile.mk b/cppu/util/makefile.mk
index 2e52c28..f868353 100644
--- a/cppu/util/makefile.mk
+++ b/cppu/util/makefile.mk
@@ -60,7 +60,7 @@ SHL1STDLIBS = $(SALLIB)
 
 SHL1DEPN=
 SHL1IMPLIB=i$(TARGET)
-.IF "$(OS)"!="FREEBSD"
+.IF "$(OS)"!="FREEBSD" && "$(OS)"!="OPENBSD"
 SHL1DEF=$(MISC)$/$(SHL1TARGET).def
 .ENDIF
 
diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h
index 4f05ece..157409b 100644
--- a/sal/inc/osl/endian.h
+++ b/sal/inc/osl/endian.h
@@ -154,9 +154,9 @@ extern "C" {
 
 /** Check supported platform.
  */
-#if !defined(_WIN32)  && !defined(_WIN16) && !defined(OS2)   && \
-    !defined(LINUX)   && !defined(NETBSD) && !defined(SCO)   && \
-    !defined(AIX)     && !defined(HPUX)   && \
+#if !defined(_WIN32)  && !defined(_WIN16) && !defined(OS2)     && \
+    !defined(LINUX)   && !defined(NETBSD) && !defined(SCO)     && \
+    !defined(AIX)     && !defined(HPUX)   && !defined(OPENBSD) && \
     !defined(SOLARIS) && !defined(MACOSX) && !defined(FREEBSD)
 #	error "Target platform not specified !"
 #endif
diff --git a/sal/inc/rtl/uuid.h b/sal/inc/rtl/uuid.h
index b0d85d0..0428970 100644
--- a/sal/inc/rtl/uuid.h
+++ b/sal/inc/rtl/uuid.h
@@ -201,6 +201,8 @@ void SAL_CALL rtl_createNamedUuid(
 #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 100000
 #elif AIX
 #define UUID_SYSTEM_TIME_RESOLUTION_100NS_TICKS 10
+#elif OPENBSD
+#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 b6c91f9..83bc5df 100644
--- a/sal/inc/sal/alloca.h
+++ b/sal/inc/sal/alloca.h
@@ -36,7 +36,7 @@
 #define INCLUDED_ALLOCA_H
 #endif
 
-#elif defined (FREEBSD) || defined(NETBSD)
+#elif defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD)
 
 #ifndef INCLUDED_STDLIB_H
 #include <stdlib.h>
diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h
index 2145977..73b66bc 100644
--- a/sal/inc/sal/config.h
+++ b/sal/inc/sal/config.h
@@ -92,7 +92,8 @@
 #define SAL_SYSCONFIGFILE( name ) name ".ini"
 #endif
 
-#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(SCO) || defined(AIX)
+#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || \
+    defined(SCO) || defined(AIX) || defined(OPENBSD)
 #define SAL_UNX
 #define SAL_DLLEXTENSION ".so"
 #define SAL_DLLPREFIX "lib"
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index 0619673..f440094 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -345,7 +345,9 @@ typedef struct _sal_Sequence
     lack RTTI support, dynamic_cast is not included here).
  */
 #ifdef __cplusplus
-#if defined SAL_W32 || defined SOLARIS || defined LINUX || defined MACOSX || defined FREEBSD || defined NETBSD || defined AIX || defined OS2
+#if defined SAL_W32 || defined SOLARIS || defined LINUX || defined MACOSX || \
+    defined FREEBSD || defined NETBSD || defined AIX || defined OS2 || \
+    defined OPENBSD
 #define SAL_CONST_CAST(type, expr) (const_cast< type >(expr))
 #define SAL_REINTERPRET_CAST(type, expr) (reinterpret_cast< type >(expr))
 #define SAL_STATIC_CAST(type, expr) (static_cast< type >(expr))
diff --git a/sal/osl/unx/backtrace.c b/sal/osl/unx/backtrace.c
index 8c20545..c32b3af 100644
--- a/sal/osl/unx/backtrace.c
+++ b/sal/osl/unx/backtrace.c
@@ -140,7 +140,7 @@ void backtrace_symbols_fd( void **buffer, int size, int fd )
 #endif /* defined SOLARIS */
 
 
-#if defined FREEBSD || defined NETBSD
+#if defined FREEBSD || defined NETBSD || defined OPENBSD
 #include <dlfcn.h>
 #include <pthread.h>
 #include <setjmp.h>
diff --git a/sal/osl/unx/backtrace.h b/sal/osl/unx/backtrace.h
index 0b7332f..1f6687b 100644
--- a/sal/osl/unx/backtrace.h
+++ b/sal/osl/unx/backtrace.h
@@ -27,7 +27,8 @@
  ************************************************************************/
 
 
-#if defined (SOLARIS) || defined (FREEBSD) || defined (NETBSD)
+#if defined (SOLARIS) || defined (FREEBSD) || defined (NETBSD) || \
+	defined (OPENBSD)
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,7 +41,7 @@ int backtrace( void **buffer, int max_frames );
 void backtrace_symbols_fd( void **buffer, int size, int fd );
 
 /* no frame.h on FreeBSD */
-#if defined (FREEBSD) || defined (NETBSD)
+#if defined (FREEBSD) || defined (NETBSD) || defined (OPENBSD)
 struct frame {
     long	arg0[8];
     long	arg1[6];
@@ -54,7 +55,7 @@ struct frame {
 } /* extern "C" */
 #endif
 
-#endif /* defined SOLARIS || FREEBSD */
+#endif /* defined SOLARIS || FREEBSD || OPENBSD */
 
 #if defined (LINUX) && defined (SPARC)
 #ifdef __cplusplus
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 066de27..94ef670 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -272,7 +272,8 @@ void FileHandle_Impl::operator delete (void * p, size_t)
 
 size_t FileHandle_Impl::getpagesize()
 {
-#if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX) || \
+	defined(OPENBSD)
     return sal::static_int_cast< size_t >(::getpagesize());
 #else /* POSIX */
     return sal::static_int_cast< size_t >(::sysconf(_SC_PAGESIZE));
diff --git a/sal/osl/unx/file_error_transl.cxx b/sal/osl/unx/file_error_transl.cxx
index 2be2fb3..a5297c7 100644
--- a/sal/osl/unx/file_error_transl.cxx
+++ b/sal/osl/unx/file_error_transl.cxx
@@ -217,19 +217,19 @@ oslFileError oslTranslateFileError(sal_Bool bIsError, int Errno)
             osl_error = osl_File_E_LOOP;
             break;
 
-#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
+#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD))
         case EILSEQ:
             osl_error = osl_File_E_ILSEQ;
             break;
 #endif /* MACOSX */
             
-#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
+#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD))
         case ENOLINK:
             osl_error = osl_File_E_NOLINK;
             break;
 #endif /* MACOSX */
             
-#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD))
+#if !(defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD))
         case EMULTIHOP:
             osl_error = osl_File_E_MULTIHOP;
             break;
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index 761ba6b..124f267 100644
--- a/sal/osl/unx/file_volume.cxx
+++ b/sal/osl/unx/file_volume.cxx
@@ -70,7 +70,7 @@ static const sal_Char* MOUNTTAB="/etc/mnttab";
 #include <sys/quota.h>
 static const sal_Char* MOUNTTAB="/etc/mtab";
 
-#elif defined(NETBSD) || defined(FREEBSD)
+#elif defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD)
 
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -180,19 +180,23 @@ oslFileError osl_getVolumeInformation( rtl_uString* ustrDirectoryURL, oslVolumeI
 
 #ifdef HAVE_STATFS_H
 
-#if defined(FREEBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD)
 #   define __OSL_STATFS_STRUCT      			struct statfs
 #   define __OSL_STATFS(dir, sfs)   			statfs((dir), (sfs))
 #   define __OSL_STATFS_BLKSIZ(a)   			((sal_uInt64)((a).f_bsize))
 #   define __OSL_STATFS_TYPENAME(a) 			((a).f_fstypename)
+#if defined(OPENBSD)
+#   define __OSL_STATFS_ISREMOTE(a)     		(rtl_str_compare((a).f_fstypename, "nfs") == 0)
+#else
 #   define __OSL_STATFS_ISREMOTE(a) 			(((a).f_type & MNT_LOCAL) == 0)
+#endif
 
 /* always return true if queried for the properties of
    the file system. If you think this is wrong under any
    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 /* FREEBSD || MACOSX */
+#endif /* FREEBSD || MACOSX || OPENBSD */
 
 #if defined(NETBSD)
 
@@ -1118,7 +1122,8 @@ osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice)
  *
  *****************************************************************************/
 
-#if (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX))
+#if (defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || \
+	defined(AIX) || defined(OPENBSD))
 static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath)
 {
     (void)pszPath;
@@ -1126,7 +1131,8 @@ static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath)
 }
 #endif /* MACOSX */
 
-#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX))
+#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || \
+	defined(AIX) || defined(OPENBSD))
 static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy)
 {
     (void)hFloppy;
@@ -1134,7 +1140,8 @@ static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy)
 }
 #endif /* MACOSX */
 
-#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || defined(AIX))
+#if ( defined(MACOSX) || defined(NETBSD) || defined(FREEBSD) || \
+	defined(AIX) || defined(OPENBSD))
 static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy)
 {
     (void)hFloppy;
@@ -1142,19 +1149,19 @@ static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy)
 }
 #endif /* MACOSX */
 
-#if ( defined(NETBSD) || defined(FREEBSD) )
+#if ( defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) )
 static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem)
 {
     return sal_False;
 }
-#endif /* NETBSD || FREEBSD */
+#endif /* NETBSD || FREEBSD || OPENBSD */
 
-#if ( defined(NETBSD) || defined(FREEBSD) )
+#if ( defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD) )
 static sal_Bool osl_isFloppyMounted(oslVolumeDeviceHandleImpl* pDevice)
 {
     return sal_False;
 }
-#endif /* NETBSD || FREEBSD */
+#endif /* NETBSD || FREEBSD || OPENBSD */
 
 
 #ifdef DEBUG_OSL_FILE
diff --git a/sal/osl/unx/makefile.mk b/sal/osl/unx/makefile.mk
index 4344e04..8c27831 100644
--- a/sal/osl/unx/makefile.mk
+++ b/sal/osl/unx/makefile.mk
@@ -118,7 +118,9 @@ OBJFILES=   $(OBJ)$/conditn.obj  \
 SLOFILES += $(SLO)$/osxlocale.obj
 .ENDIF
 
-.IF "$(OS)"=="SOLARIS" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || "$(OS)$(CPU)"=="LINUXS" || "$(OS)"=="MACOSX" || "$(OS)"=="AIX"
+.IF "$(OS)"=="SOLARIS" || "$(OS)"=="FREEBSD" || "$(OS)"=="NETBSD" || \
+	"$(OS)$(CPU)"=="LINUXS" || "$(OS)"=="MACOSX" || \
+	"$(OS)"=="AIX" || "$(OS)"=="OPENBSD"
 SLOFILES += $(SLO)$/backtrace.obj
 OBJFILES += $(OBJ)$/backtrace.obj
 .ENDIF
diff --git a/sal/osl/unx/nlsupport.c b/sal/osl/unx/nlsupport.c
index 4787ab8..f7ae5a2 100644
--- a/sal/osl/unx/nlsupport.c
+++ b/sal/osl/unx/nlsupport.c
@@ -31,7 +31,8 @@
 #include <osl/process.h>
 #include <rtl/memory.h>
 
-#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD) || defined(MACOSX)
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || \
+	defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD)
 #include <pthread.h>
 #ifndef MACOSX
  #include <locale.h>
@@ -232,7 +233,8 @@ static rtl_Locale * _parse_locale( const char * locale )
     return NULL;
 }
         
-#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || defined(FREEBSD)
+#if defined(LINUX) || defined(SOLARIS) || defined(NETBSD) || \
+	defined(FREEBSD) || defined(OPENBSD)
 
 /*
  * This implementation of osl_getTextEncodingFromLocale maps
@@ -543,7 +545,31 @@ const _pair _nl_language_list[] = {
     { "UTF-8",         RTL_TEXTENCODING_UTF8           }  /* ISO-10646/UTF-8 */
 };
 
-#endif /* ifdef SOLARIS LINUX FREEBSD NETBSD */
+#elif defined(OPENBSD)
+
+const _pair _nl_language_list[] = {
+    { "ASCII",         RTL_TEXTENCODING_ASCII_US       }, /* US-ASCII */
+    { "BIG5",          RTL_TEXTENCODING_BIG5           }, /* China - Traditional Chinese */
+    { "CP1251",        RTL_TEXTENCODING_MS_1251        }, /* MS-CYRL */
+    { "CP866",         RTL_TEXTENCODING_IBM_866        }, /* CP866 866 */
+    { "EUCCN",         RTL_TEXTENCODING_EUC_CN         }, /* China - Simplified Chinese */
+    { "EUCJP",         RTL_TEXTENCODING_EUC_JP         }, /* Japan */
+    { "EUCKR",         RTL_TEXTENCODING_EUC_KR         }, /* Korea */
+    { "ISO8859-1",     RTL_TEXTENCODING_ISO_8859_1     }, /* Western */
+    { "ISO8859-15",    RTL_TEXTENCODING_ISO_8859_15    }, /* Western Updated (w/Euro sign) */
+    { "ISO8859-2",     RTL_TEXTENCODING_ISO_8859_2     }, /* Central European */
+    { "ISO8859-4",     RTL_TEXTENCODING_ISO_8859_4     }, /* LATIN4 L4 */
+    { "ISO8859-5",     RTL_TEXTENCODING_ISO_8859_5     }, /* Cyrillic */
+    { "ISO8859-7",     RTL_TEXTENCODING_ISO_8859_7     }, /* Greek */
+    { "ISO8859-9",     RTL_TEXTENCODING_ISO_8859_9     }, /* Turkish */
+    { "KOI8-R",        RTL_TEXTENCODING_KOI8_R         }, /* KOI8-R */
+    { "KOI8-U",        RTL_TEXTENCODING_KOI8_U         }, /* KOI8-U */
+    { "SJIS",          RTL_TEXTENCODING_SHIFT_JIS      }, /* Japan */
+    { "US-ASCII",      RTL_TEXTENCODING_ASCII_US       }, /* US-ASCII */
+    { "UTF-8",         RTL_TEXTENCODING_UTF8           }  /* ISO-10646/UTF-8 */
+};
+
+#endif /* ifdef SOLARIS LINUX FREEBSD NETBSD OPENBSD */
 
 static pthread_mutex_t aLocalMutex = PTHREAD_MUTEX_INITIALIZER;
 
@@ -925,7 +951,8 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
     {
         /* only change env vars that exist already */
         if( getenv( "LC_ALL" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined ( AIX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
+	defined( AIX ) || defined( OPENBSD )
             setenv( "LC_ALL", locale_buf, 1);
 #else
             setenv( "LC_ALL", locale_buf );
@@ -933,7 +960,8 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
         }
 
         if( getenv( "LC_CTYPE" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined ( AIX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
+	defined( AIX ) || defined( OPENBSD )
             setenv("LC_CTYPE", locale_buf, 1 );
 #else
             setenv( "LC_CTYPE", locale_buf );
@@ -941,7 +969,8 @@ int _imp_setProcessLocale( rtl_Locale * pLocale )
         }
 
         if( getenv( "LANG" ) ) {
-#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || defined (AIX )
+#if defined( FREEBSD ) || defined( NETBSD ) || defined( MACOSX ) || \
+	defined( AIX ) || defined( OPENBSD)
             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 0afcfc4..0c85bf0 100644
--- a/sal/osl/unx/process.c
+++ b/sal/osl/unx/process.c
@@ -476,7 +476,7 @@ static void ChildStatusProc(void *pData)
 
             if (! INIT_GROUPS(data.m_name, data.m_gid) || (setuid(data.m_uid) != 0))
                 OSL_TRACE("Failed to change uid and guid, errno=%d (%s)\n", errno, strerror(errno));
-#if defined(LINUX) || defined (FREEBSD) || defined(NETBSD)
+#if defined(LINUX) || defined (FREEBSD) || defined(NETBSD) || defined(OPENBSD)
             unsetenv("HOME");
 #else
             putenv("HOME=");
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 21ca9b6..90fe9eb 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -46,7 +46,8 @@
 #undef HAVE_POLL_H
 #endif
 
-#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || defined (MACOSX)
+#if defined(LINUX) || defined(NETBSD) || defined ( FREEBSD ) || \
+	defined (MACOSX) || defined (OPENBSD)
 #include <sys/poll.h>
 #define HAVE_POLL_H
 #endif /* HAVE_POLL_H */
diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h
index 0163863..4b6b766 100644
--- a/sal/osl/unx/system.h
+++ b/sal/osl/unx/system.h
@@ -200,6 +200,32 @@
 #	define  NO_PTHREAD_RTL
 #endif
 
+#ifdef OPENBSD
+#   define  ETIME ETIMEDOUT
+#   define _POSIX_THREAD_SYSCALL_SOFT 1
+#   include <pthread.h>
+#   include <sys/sem.h>
+#   include <semaphore.h>
+#   include <dlfcn.h>
+#   include <sys/filio.h>
+#   include <sys/ioctl.h>
+#   include <sys/param.h>
+#   include <sys/time.h>
+#   include <sys/uio.h>
+#   include <sys/exec.h>
+#       include <sys/un.h>
+#   include <netinet/tcp.h>
+#       define  IORESOURCE_TRANSFER_BSD
+#   include <machine/endian.h>
+#      define  PTR_SIZE_T(s)   ((size_t *)&(s))
+#       define  IORESOURCE_TRANSFER_BSD
+#       define  IOCHANNEL_TRANSFER_BSD_RENO
+#       define  pthread_testcancel()
+#       define  NO_PTHREAD_PRIORITY
+#       define  NO_PTHREAD_RTL
+#       define  PTHREAD_SIGACTION                       pthread_sigaction
+#endif
+
 #ifdef SCO
 #   define AF_IPX -1
 #	include <strings.h>
@@ -349,7 +375,8 @@ 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(MACOSX)
+    !defined(SOLARIS) && !defined(MACOSX) && \
+    !defined(OPENBSD)
 #	error "Target platform not specified!"
 #endif
 
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c
index 63a8b24..0e5ccc7 100644
--- a/sal/osl/unx/thread.c
+++ b/sal/osl/unx/thread.c
@@ -28,6 +28,9 @@
 
 #include "system.h"
 #include <string.h>
+#if defined(OPENBSD)
+#include <sched.h>
+#endif
 #include <osl/diagnose.h>
 #include <osl/thread.h>
 #include <osl/nlsupport.h>
@@ -280,6 +283,9 @@ static oslThread osl_thread_create_Impl (
     short             nFlags)
 {
     Thread_Impl* pImpl;
+#if defined(OPENBSD)
+    pthread_attr_t attr;
+#endif
     int nRet=0;
 
     pImpl = osl_thread_construct_Impl();
@@ -292,9 +298,23 @@ static oslThread osl_thread_create_Impl (
 
     pthread_mutex_lock (&(pImpl->m_Lock));
 
+#if defined(OPENBSD)
+    if (pthread_attr_init(&attr) != 0)
+        return (0);
+
+    if (pthread_attr_setstacksize(&attr, 262144) != 0) {
+        pthread_attr_destroy(&attr);
+        return (0);
+    }
+#endif
+
     if ((nRet = pthread_create (
         &(pImpl->m_hThread),
+#if defined(OPENBSD)
+        &attr,
+#else
         PTHREAD_ATTR_DEFAULT,
+#endif
         osl_thread_start_Impl,
         (void*)(pImpl))) != 0)
     {
@@ -307,6 +327,10 @@ static oslThread osl_thread_create_Impl (
         return (0);
     }
 
+#if defined(OPENBSD)
+    pthread_attr_destroy(&attr);
+#endif
+
     /* wait for change from STARTUP to ACTIVE state */
     while (pImpl->m_Flags & THREADIMPL_FLAGS_STARTUP)
     {
diff --git a/sal/osl/unx/time.c b/sal/osl/unx/time.c
index 2dae526..db03442 100644
--- a/sal/osl/unx/time.c
+++ b/sal/osl/unx/time.c
@@ -33,7 +33,8 @@
 #include <osl/time.h>
 
 /* FIXME: detection should be done in configure script */
-#if defined(MACOSX) || defined(FREEBSD) || defined(NETBSD) || defined(LINUX)
+#if defined(MACOSX) || defined(FREEBSD) || defined(NETBSD) || \
+	defined(LINUX) || defined(OPENBSD)
 #define STRUCT_TM_HAS_GMTOFF 1
 
 #elif defined(SOLARIS)
diff --git a/sal/rtl/source/alloc.c b/sal/rtl/source/alloc.c
index 83105f9..b4c513a 100644
--- a/sal/rtl/source/alloc.c
+++ b/sal/rtl/source/alloc.c
@@ -70,7 +70,8 @@ typedef pthread_mutex_t mutex_type;
 #define RTL_MUTEX_ACQUIRE(a)  pthread_mutex_lock((a))
 #define RTL_MUTEX_RELEASE(a)  pthread_mutex_unlock((a))
 
-#if   defined(FREEBSD) || defined(NETBSD) || defined(MACOSX)
+#if defined(FREEBSD) || defined(NETBSD) || defined(MACOSX) || \
+	defined(OPENBSD)
 static sal_Size __rtl_memory_vmpagesize (void)
 {
     /* xBSD */
@@ -88,7 +89,7 @@ static sal_Size __rtl_memory_vmpagesize (void)
     /* other */
     return (sal_Size)(0x2000);
 }
-#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS || AIX */
+#endif /* FREEBSD || NETBSD || MACOSX || LINUX || SOLARIS || AIX || OPENBSD*/
 
 #ifndef PROT_HEAP
 #define PROT_HEAP (PROT_READ | PROT_WRITE | PROT_EXEC)
diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx
index 94f750b..7028840 100644
--- a/sal/rtl/source/macro.hxx
+++ b/sal/rtl/source/macro.hxx
@@ -53,6 +53,8 @@
 #define THIS_OS "FreeBSD"
 #elif defined AIX
 #define THIS_OS "AIX"
+#elif defined OPENBSD
+#define THIS_OS "OpenBSD"
 #endif
 
 #if ! defined THIS_OS
diff --git a/sal/workben/makefile.mk b/sal/workben/makefile.mk
index c93d756..99795f6 100644
--- a/sal/workben/makefile.mk
+++ b/sal/workben/makefile.mk
@@ -366,7 +366,8 @@ APP4DEPN=	$(SLB)$/sal.lib
 # tgetpwnam
 #
 .IF "$(TESTAPP)" == "tgetpwnam"
-.IF "$(OS)"=="SCO" || "$(OS)"=="NETBSD" || "$(OS)"=="FREEBSD"
+.IF "$(OS)"=="SCO" || "$(OS)"=="NETBSD" || "$(OS)"=="FREEBSD" || \
+	"$(OS)"=="OPENBSD"
 
 CXXFILES=	tgetpwnam.cxx
 OBJFILES=	$(OBJ)$/tgetpwnam.obj


More information about the Libreoffice-commits mailing list