Kaydet (Commit) 0574ad9d authored tarafından Tor Lillqvist's avatar Tor Lillqvist

First attempt at Android support

üst ec1c09b9
......@@ -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
......
......@@ -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>
......
......@@ -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"
......
......@@ -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)
......
......@@ -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);
......
......@@ -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)
......
......@@ -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,
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment