summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-06-09 21:41:35 +0300
committerTor Lillqvist <tlillqvist@novell.com>2011-06-09 21:42:25 +0300
commit04a97047aea7117e14bcb6889e839457e5ef5f2a (patch)
treef3757bc0bb509302a1ee1a0962d552ea576521ad /sal
parent22e611ef9a0b73d02e5147015cfd5f67ddc9b34c (diff)
First attempt at Android support
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/osl/endian.h17
-rw-r--r--sal/inc/sal/alloca.h2
-rw-r--r--sal/inc/sal/config.h2
-rw-r--r--sal/osl/unx/file_volume.cxx14
-rw-r--r--sal/osl/unx/security.c5
-rw-r--r--sal/osl/unx/signal.c6
-rw-r--r--sal/osl/unx/socket.c2
-rw-r--r--sal/osl/unx/system.h17
-rw-r--r--sal/rtl/source/macro.hxx2
9 files changed, 54 insertions, 13 deletions
diff --git a/sal/inc/osl/endian.h b/sal/inc/osl/endian.h
index 9abf8cf8f..3d9bba828 100644
--- a/sal/inc/osl/endian.h
+++ b/sal/inc/osl/endian.h
@@ -66,6 +66,21 @@ extern "C" {
# endif
#endif
+#ifdef ANDROID
+# include <endian.h>
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# ifndef _LITTLE_ENDIAN
+# define _LITTLE_ENDIAN
+# endif
+# elif __BYTE_ORDER == __BIG_ENDIAN
+# ifndef _BIG_ENDIAN
+# define _BIG_ENDIAN
+# endif
+# elif __BYTE_ORDER == __PDP_ENDIAN
+# define _PDP_ENDIAN
+# endif
+#endif
+
#ifdef NETBSD
# include <machine/endian.h>
# if BYTE_ORDER == LITTLE_ENDIAN
@@ -154,7 +169,7 @@ extern "C" {
!defined(AIX) && !defined(OPENBSD) && \
!defined(SOLARIS) && !defined(MACOSX) && !defined(FREEBSD) && \
!defined(DRAGONFLY) && \
- !defined(IOS)
+ !defined(IOS) && !defined(ANDROID)
# error "Target platform not specified !"
#endif
diff --git a/sal/inc/sal/alloca.h b/sal/inc/sal/alloca.h
index eb31ad591..087746ff7 100644
--- a/sal/inc/sal/alloca.h
+++ b/sal/inc/sal/alloca.h
@@ -29,7 +29,7 @@
#ifndef INCLUDED_SAL_ALLOCA_H
#define INCLUDED_SAL_ALLOCA_H
-#if defined (SOLARIS) || defined (LINUX) || defined(__EMX__) || defined(AIX)
+#if defined (SOLARIS) || defined (LINUX) || defined(__EMX__) || defined(AIX) || defined(ANDROID)
#ifndef INCLUDED_ALLOCA_H
#include <alloca.h>
diff --git a/sal/inc/sal/config.h b/sal/inc/sal/config.h
index 599a8bcee..9da307a04 100644
--- a/sal/inc/sal/config.h
+++ b/sal/inc/sal/config.h
@@ -75,7 +75,7 @@
#endif /* defined WIN32 */
#if defined(SOLARIS) || defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || \
- defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY)
+ defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY) || defined(ANDROID)
#define SAL_UNX
#define SAL_DLLEXTENSION ".so"
#define SAL_DLLPREFIX "lib"
diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx
index 4a941ff93..cc3008914 100644
--- a/sal/osl/unx/file_volume.cxx
+++ b/sal/osl/unx/file_volume.cxx
@@ -1114,36 +1114,36 @@ osl_isFloppyMounted (oslVolumeDeviceHandleImpl* pDevice)
/******************************************************************************
*
- * MAC OS X AND IOS FLOPPY FUNCTIONS: NO FLOPPIES
+ * Dummy floppy functions: no stinking floppies
*
*****************************************************************************/
-#if (defined(MACOSX) || defined(IOS) || defined(NETBSD) || defined(FREEBSD) || \
+#if (defined(MACOSX) || defined(IOS) || defined(ANDROID) || defined(NETBSD) || defined(FREEBSD) || \
defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY))
static oslVolumeDeviceHandle osl_isFloppyDrive(const sal_Char* pszPath)
{
(void)pszPath;
return NULL;
}
-#endif /* MACOSX */
+#endif
-#if ( defined(MACOSX) || defined(IOS) || defined(NETBSD) || defined(FREEBSD) || \
+#if ( defined(MACOSX) || defined(IOS) || defined(ANDROID) || defined(NETBSD) || defined(FREEBSD) || \
defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY))
static oslFileError osl_mountFloppy(oslVolumeDeviceHandle hFloppy)
{
(void)hFloppy;
return osl_File_E_BUSY;
}
-#endif /* MACOSX */
+#endif
-#if ( defined(MACOSX) || defined(IOS) || defined(NETBSD) || defined(FREEBSD) || \
+#if ( defined(MACOSX) || defined(IOS) || defined(ANDROID) || defined(NETBSD) || defined(FREEBSD) || \
defined(AIX) || defined(OPENBSD) || defined(DRAGONFLY))
static oslFileError osl_unmountFloppy(oslVolumeDeviceHandle hFloppy)
{
(void)hFloppy;
return osl_File_E_BUSY;
}
-#endif /* MACOSX */
+#endif
#if ( defined(NETBSD) || defined(IOS) || defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY) )
static sal_Bool osl_getFloppyMountEntry(const sal_Char* pszPath, oslVolumeDeviceHandleImpl* pItem)
diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c
index f0f82eca1..3a42b66d4 100644
--- a/sal/osl/unx/security.c
+++ b/sal/osl/unx/security.c
@@ -48,6 +48,11 @@
#include "secimpl.h"
+#ifdef ANDROID
+#define getpwuid_r(uid, pwd, buf, buflen, result) (*(result) = getpwuid(uid), (*(result) ? (memcpy (buf, *(result), sizeof (struct passwd)), 0) : errno))
+#endif
+
+
static oslSecurityError SAL_CALL
osl_psz_loginUser(const sal_Char* pszUserName, const sal_Char* pszPasswd,
oslSecurity* pSecurity);
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c
index 71eefcaee..360e25c57 100644
--- a/sal/osl/unx/signal.c
+++ b/sal/osl/unx/signal.c
@@ -820,22 +820,24 @@ static int ReportCrash( int Signal )
static void PrintStack( int sig )
{
-#if ! defined(MACOSX) || defined(INCLUDE_BACKTRACE)
+#ifdef INCLUDE_BACKTRACE
void *buffer[MAX_STACK_FRAMES];
int size = backtrace( buffer, SAL_N_ELEMENTS(buffer) );
#endif
fprintf( stderr, "\n\nFatal exception: Signal %d\n", sig );
-#if defined(MACOSX) && ! defined(INCLUDE_BACKTRACE)
+#ifdef MACOSX
fprintf( stderr, "Please turn on Enable Crash Reporting and\nAutomatic Display of Crashlogs in the Console application\n" );
#else
+#ifdef INCLUDE_BACKTRACE
if ( size > 0 )
{
fputs( "Stack:\n", stderr );
backtrace_symbols_fd( buffer, size, fileno(stderr) );
}
#endif
+#endif
}
static oslSignalAction CallSignalHandler(oslSignalInfo *pInfo)
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index b9fb92e42..bcf5a72f8 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -791,7 +791,7 @@ static struct hostent* _osl_gethostbyname_r (
const char *name, struct hostent *result,
char *buffer, int buflen, int *h_errnop)
{
-#if defined(LINUX) || (defined(FREEBSD) && (__FreeBSD_version >= 601103)) || defined(DRAGONFLY)
+#if defined(LINUX) || defined(ANDROID) || (defined(FREEBSD) && (__FreeBSD_version >= 601103)) || defined(DRAGONFLY)
struct hostent *__result; /* will be the same as result */
int __error;
__error = gethostbyname_r (name, result, buffer, buflen,
diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h
index 9ff6cc48f..d9c90d204 100644
--- a/sal/osl/unx/system.h
+++ b/sal/osl/unx/system.h
@@ -135,6 +135,23 @@
#endif
+#ifdef ANDROID
+# include <pthread.h>
+# include <sys/file.h>
+# include <sys/ioctl.h>
+# include <sys/uio.h>
+# include <sys/un.h>
+# include <netinet/tcp.h>
+# include <dlfcn.h>
+# include <endian.h>
+# include <sys/time.h>
+# include <semaphore.h>
+# define IORESOURCE_TRANSFER_BSD
+# define IOCHANNEL_TRANSFER_BSD_RENO
+# define pthread_testcancel()
+# define NO_PTHREAD_PRIORITY
+#endif
+
#ifdef NETBSD
# include <sys/param.h>
# ifndef ETIME
diff --git a/sal/rtl/source/macro.hxx b/sal/rtl/source/macro.hxx
index 25674513a..b07c7705c 100644
--- a/sal/rtl/source/macro.hxx
+++ b/sal/rtl/source/macro.hxx
@@ -43,6 +43,8 @@
#else
#define THIS_OS "Linux"
#endif
+#elif defined ANDROID
+#define THIS_OS "Android"
#elif defined MACOSX
#define THIS_OS "MacOSX"
#elif defined IOS