diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-01-26 10:29:38 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-01-26 10:29:38 +0000 |
commit | 7c4c1832ccd4830f903d7d647466f96aa6755711 (patch) | |
tree | 068c7fad565eef36d17ed45207065d7002b863e0 /sal | |
parent | android: add missing deployment component (diff) | |
download | core-7c4c1832ccd4830f903d7d647466f96aa6755711.tar.gz core-7c4c1832ccd4830f903d7d647466f96aa6755711.zip |
android: move lo-bootstrap to osl/detail, Attach threads as created
Diffstat (limited to 'sal')
-rw-r--r-- | sal/Package_inc.mk | 1 | ||||
-rw-r--r-- | sal/android/lo-bootstrap.c | 2 | ||||
-rw-r--r-- | sal/inc/osl/detail/android-bootstrap.h | 80 | ||||
-rw-r--r-- | sal/osl/unx/file.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/module.c | 2 | ||||
-rw-r--r-- | sal/osl/unx/process_impl.cxx | 2 | ||||
-rw-r--r-- | sal/osl/unx/thread.c | 18 | ||||
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 2 |
9 files changed, 106 insertions, 7 deletions
diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk index e43de3e46388..304ab9d68797 100644 --- a/sal/Package_inc.mk +++ b/sal/Package_inc.mk @@ -65,6 +65,7 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/time.h,osl/time.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/util.h,osl/util.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/file.h,osl/detail/file.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android_native_app_glue.h,osl/detail/android_native_app_glue.h)) +$(eval $(call gb_Package_add_file,sal_inc,inc/osl/detail/android-bootstrap.h,osl/detail/android-bootstrap.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/allocator.hxx,rtl/allocator.hxx)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/alloc.h,rtl/alloc.h)) $(eval $(call gb_Package_add_file,sal_inc,inc/rtl/bootstrap.h,rtl/bootstrap.h)) diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c index 55bc643f38ab..98db089c2d7d 100644 --- a/sal/android/lo-bootstrap.c +++ b/sal/android/lo-bootstrap.c @@ -48,7 +48,7 @@ #include "uthash.h" -#include "lo-bootstrap.h" +#include "osl/detail/android-bootstrap.h" #pragma GCC diagnostic ignored "-Wdeclaration-after-statement" diff --git a/sal/inc/osl/detail/android-bootstrap.h b/sal/inc/osl/detail/android-bootstrap.h new file mode 100644 index 000000000000..65396873ac93 --- /dev/null +++ b/sal/inc/osl/detail/android-bootstrap.h @@ -0,0 +1,80 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http: *www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2011 Tor Lillqvist <tml@iki.fi> (initial developer) + * Copyright (C) 2011 SUSE Linux http://suse.com (initial developer's employer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef ANDROID_BOOSTRAP_H +#define ANDROID_BOOSTRAP_H +#if defined(ANDROID) + +#include <jni.h> +#include <dlfcn.h> +#include <dirent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct lo_apk_dir lo_apk_dir; + +char **lo_dlneeds(const char *library); + +void *lo_dlopen(const char *library); + +void *lo_dlsym(void *handle, + const char *symbol); + +int lo_dladdr(void *addr, + Dl_info *info); + +void *lo_apkentry(const char *filename, + size_t *size); + +lo_apk_dir *lo_apk_opendir(const char *dirname); + +struct dirent *lo_apk_readdir(lo_apk_dir *dirp); + +int lo_apk_closedir(lo_apk_dir *dirp); + +int lo_apk_lstat(const char *path, struct stat *statp); + +int lo_dlcall_argc_argv(void *function, + int argc, + const char **argv); + +JavaVM *lo_get_javavm(void); + +struct android_app *lo_get_app(void); + +#ifdef __cplusplus +} +#endif + +#endif // ANDROID +#endif // ANDROID_BOOTSTRAP_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 63e9775fa25e..b8a851f5a84d 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -59,7 +59,7 @@ #endif /* MACOSX */ #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif #ifdef DEBUG_OSL_FILE diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 260b711ee1da..962d7bf3701a 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -55,7 +55,7 @@ #include <algorithm> #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /************************************************************************ @@ -774,7 +774,7 @@ static oslFileError osl_psz_removeFile( const sal_Char* pszPath ) int nRet=0; struct stat aStat; - nRet = lstat(pszPath,&aStat); + nRet = lstat_c(pszPath,&aStat); if ( nRet < 0 ) { nRet=errno; diff --git a/sal/osl/unx/module.c b/sal/osl/unx/module.c index 2889a7723a91..792f0cd81207 100644 --- a/sal/osl/unx/module.c +++ b/sal/osl/unx/module.c @@ -44,7 +44,7 @@ #endif #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /* implemented in file.c */ diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 83c5c8872dbe..d90fdea310ff 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -60,7 +60,7 @@ #include "uunxapi.h" #ifdef ANDROID -#include <lo-bootstrap.h> +#include <osl/detail/android-bootstrap.h> #endif /*************************************** diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 4128d08f0d63..59a0514b322b 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -37,6 +37,10 @@ #include <rtl/textenc.h> #include <rtl/alloc.h> #include <sal/macros.h> +#ifdef ANDROID +#include <jni.h> +#include <osl/detail/android-bootstrap.h> +#endif #if defined LINUX && ! defined __FreeBSD_kernel__ #include <sys/prctl.h> @@ -288,8 +292,22 @@ static void* osl_thread_start_Impl (void* pData) if (!terminate) { +#ifdef ANDROID + { + JNIEnv* env = 0; + int res = (*lo_get_javavm())->AttachCurrentThread(lo_get_javavm(), &env, NULL); // res == 0 + fprintf (stderr, "new sal thread started and attached %d!\n", res); + } +#endif /* call worker function */ pImpl->m_WorkerFunction(pImpl->m_pData); + +#ifdef ANDROID + { + int res = (*lo_get_javavm())->DetachCurrentThread(lo_get_javavm()); + fprintf (stderr, "detached finished sal thread %d!\n", res); + } +#endif } /* call cleanup handler and leave */ diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 8abe57f3b2f7..270f5c33513a 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -48,7 +48,7 @@ #endif #ifdef ANDROID - #include <lo-bootstrap.h> + #include <osl/detail/android-bootstrap.h> #endif //########################### |