1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025215: Porting to Android - fix minor issues

STEPConstruct_AP203Context = pw_gecos member of passwd struct disabled in android case.
Standard_Atomic - correct usage of __atomic_inc()/__atomic_dec().
Standard_CLocaleSentry - Android doesn't support locales in the C library.
Standard_MMgrOpt - use "/dev/zero" and "/dev/null" for allocation of memory blocks on Android.
OSD_Chronometer - fix compilation on Android.
OSD_Disk, OSD_signal - fix headers inclusion on Android.
This commit is contained in:
kgv
2014-09-05 14:27:01 +04:00
committed by bugmaster
parent aaf512f112
commit 9bf6baed3c
8 changed files with 49 additions and 23 deletions

View File

@@ -57,7 +57,7 @@
//=======================================================================
void OSD_Chronometer::GetProcessCPU (Standard_Real& UserSeconds, Standard_Real& SystemSeconds)
{
#if defined(LIN) || defined(linux) || defined(__FreeBSD__)
#if defined(LIN) || defined(linux) || defined(__FreeBSD__) || defined(__ANDROID__)
static const long aCLK_TCK = sysconf(_SC_CLK_TCK);
#else
static const long aCLK_TCK = CLK_TCK;
@@ -87,7 +87,7 @@ void OSD_Chronometer::GetThreadCPU (Standard_Real& theUserSeconds,
theUserSeconds = Standard_Real(aTaskInfo.user_time.seconds) + 0.000001 * aTaskInfo.user_time.microseconds;
theSystemSeconds = Standard_Real(aTaskInfo.system_time.seconds) + 0.000001 * aTaskInfo.system_time.microseconds;
}
#elif defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)
#elif (defined(_POSIX_TIMERS) && defined(_POSIX_THREAD_CPUTIME)) || defined(__ANDROID__)
// on Linux, only user times are available for threads via clock_gettime()
struct timespec t;
if (!clock_gettime (CLOCK_THREAD_CPUTIME_ID, &t))

View File

@@ -12,7 +12,7 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef WNT
#ifndef _WIN32
#include <OSD_Disk.ixx>
#include <OSD_WhoAmI.hxx>
@@ -23,16 +23,21 @@ const OSD_WhoAmI Iam = OSD_WDisk;
extern "C" {
#endif
#include <sys/statvfs.h>
#if defined(__ANDROID__)
#include <sys/vfs.h>
#define statvfs statfs
#define fstatvfs fstatfs
#else
#include <sys/statvfs.h>
int statvfs(const char *, struct statvfs *);
#endif
#ifdef __cplusplus
}
#endif
#endif
#include <errno.h>
extern "C" {int statvfs(const char *, struct statvfs *); }
OSD_Disk::OSD_Disk() : myQuotaSize(0) {}

View File

@@ -13,7 +13,7 @@
#include <OSD.ixx>
#ifndef WNT
#ifndef _WIN32
//---------- All Systems except Windows NT : ----------------------------------
@@ -68,9 +68,12 @@ typedef void (* SIG_PFV) (int);
typedef void (* SIG_PFV) (int);
#include <signal.h>
#include <sys/signal.h>
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
#if !defined(__ANDROID__)
#include <sys/signal.h>
#endif
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
//============================================================================
//==== GetOldSigAction
//==== get previous