summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorRobert Nagy <robert@openbsd.org>2010-11-04 09:25:04 +0100
committerThorsten Behrens <tbehrens@novell.com>2010-11-04 09:25:04 +0100
commit7659ad44e3e1c955400c77dc1d45cc481faf55bf (patch)
tree28911f518f908174f06667beac94992caec05667 /sal
parente456a0804052a0ad0a4daef4fad9c5205bd7aa60 (diff)
Patches for ure, neeed by OpenBSD
Adds the necessary distinctions in the system abstraction layers.
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/osl/endian.h6
-rw-r--r--sal/inc/rtl/uuid.h2
-rw-r--r--sal/inc/sal/alloca.h2
-rw-r--r--sal/inc/sal/config.h3
-rw-r--r--sal/inc/sal/types.h4
-rw-r--r--sal/osl/unx/backtrace.c2
-rw-r--r--sal/osl/unx/backtrace.h7
-rw-r--r--sal/osl/unx/file.cxx3
-rw-r--r--sal/osl/unx/file_error_transl.cxx6
-rw-r--r--sal/osl/unx/file_volume.cxx27
-rw-r--r--sal/osl/unx/makefile.mk4
-rw-r--r--sal/osl/unx/nlsupport.c41
-rw-r--r--sal/osl/unx/process.c2
-rw-r--r--sal/osl/unx/socket.c3
-rw-r--r--sal/osl/unx/system.h29
-rw-r--r--sal/osl/unx/thread.c24
-rw-r--r--sal/osl/unx/time.c3
-rw-r--r--sal/rtl/source/alloc.c5
-rw-r--r--sal/rtl/source/macro.hxx2
-rw-r--r--sal/workben/makefile.mk3
20 files changed, 140 insertions, 38 deletions
diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h
index 9314c7fcfe5e..c9004bdab642 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 fa3883989231..d17c328fe638 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 8e1dec305b1f..0580a1faa42f 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 cd4e10b71a56..9cdf2ac3fd18 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 36b45009667a..9fac15ad319e 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 69dafac3b3dc..7787ee997c52 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 4e35afe5d986..63b5fd33f93b 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 83185749bff9..c18960f4d872 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 6d81c107f750..f9c858078c1d 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 5e916846e712..bc3812839979 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 4344e04aac38..8c27831db580 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 6ae8abd18e00..f78aa92c25dd 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 1c4454c96092..5a94380f0020 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 bf6e4d633ac0..e736e7c52e85 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 d066878772f6..3a61f67aec40 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 1c8fdad8f643..689b78dc748a 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 22440f9660f1..bc0931bd4ce5 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 759aacfaf8b2..fb4f8767106f 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 8ae03eab2aec..bb86b7d9ae39 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 c93d756ba132..99795f6fbe16 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