diff --git a/src/libYARP_OS/src/BottleImpl.cpp b/src/libYARP_OS/src/BottleImpl.cpp index 24d19af3aae..458fc51e1d1 100644 --- a/src/libYARP_OS/src/BottleImpl.cpp +++ b/src/libYARP_OS/src/BottleImpl.cpp @@ -805,10 +805,25 @@ ConstString StoreDouble::toStringFlex() const // YARP Bug 2526259: Locale settings influence YARP behavior // Need to deal with alternate versions of the decimal point. +#ifndef __ANDROID__ struct lconv* lc = localeconv(); size_t offset = str.find(lc->decimal_point); if (offset != ConstString::npos) { str[offset] = '.'; +#else + const char *decimalPoint; + #ifdef HAVE_LOCALECONV + struct lconv * lc=localeconv(); + decimalPoint = lc->decimal_point; + #else + decimalPoint = getenv("LOCALE_DECIMAL_POINT"); + #endif + if (!decimalPoint) + decimalPoint = "."; + size_t offset = str.find(decimalPoint); + if (offset!=String::npos){ + str[offset]='.'; +#endif } else { str += ".0"; } @@ -837,8 +852,22 @@ void StoreDouble::fromString(const ConstString& src) ConstString tmp = src; size_t offset = tmp.find("."); if (offset != ConstString::npos) { - struct lconv* lc = localeconv(); - tmp[offset] = lc->decimal_point[0]; + #ifndef __ANDROID__ + struct lconv* lc = localeconv(); + tmp[offset] = lc->decimal_point[0]; + #else + const char *decimalPoint; + #ifdef HAVE_LOCALECONV + struct lconv * lc=localeconv(); + decimalPoint = lc->decimal_point; + #else + decimalPoint = getenv("LOCALE_DECIMAL_POINT"); + #endif + if (!decimalPoint) + decimalPoint = "."; + + tmp[offset] = decimalPoint[0]; + #endif } x = ACE_OS::strtod(tmp.c_str(), NULL); } diff --git a/src/libYARP_OS/src/PortCore.cpp b/src/libYARP_OS/src/PortCore.cpp index 2da41039617..e6d619b7b7e 100644 --- a/src/libYARP_OS/src/PortCore.cpp +++ b/src/libYARP_OS/src/PortCore.cpp @@ -2419,7 +2419,9 @@ bool PortCore::setProcessSchedulingParam(int priority, int policy) { #if defined(__linux__) // set the sched properties of all threads within the process struct sched_param sch_param; +#ifndef __ANDROID__ sch_param.__sched_priority = priority; +#endif DIR *dir; char path[PATH_MAX]; diff --git a/src/libYARP_OS/src/SystemInfo.cpp b/src/libYARP_OS/src/SystemInfo.cpp index 9cdedf4dd60..5c7daaee61d 100644 --- a/src/libYARP_OS/src/SystemInfo.cpp +++ b/src/libYARP_OS/src/SystemInfo.cpp @@ -31,7 +31,9 @@ using namespace yarp::os; #include #include #include +#ifndef __ANDROID__ #include +#endif #include extern char **environ; @@ -296,13 +298,14 @@ SystemInfo::StorageInfo SystemInfo::getStorageInfo() yarp::os::ConstString strHome = getUserInfo().homeDir; if(!strHome.length()) strHome = "/home"; - + #ifndef __ANDROID__ struct statvfs vfs; if(statvfs(strHome.c_str(), &vfs) == 0) { storage.totalSpace = (int)(vfs.f_blocks*vfs.f_bsize/(1048576)); // in MB storage.freeSpace = (int)(vfs.f_bavail*vfs.f_bsize/(1048576)); // in MB } + #endif #endif return storage; @@ -696,8 +699,10 @@ SystemInfo::ProcessInfo SystemInfo::getProcessInfo(int pid) { // scheduling params struct sched_param param; + #ifndef __ANDROID__ if( sched_getparam(pid, ¶m) == 0 ) info.schedPriority = param.__sched_priority; + #endif info.schedPolicy = sched_getscheduler(pid); #elif defined(WIN32) diff --git a/src/libYARP_OS/src/ThreadImpl.cpp b/src/libYARP_OS/src/ThreadImpl.cpp index ff66d861a5a..f1a1029a7ea 100644 --- a/src/libYARP_OS/src/ThreadImpl.cpp +++ b/src/libYARP_OS/src/ThreadImpl.cpp @@ -82,7 +82,11 @@ PLATFORM_THREAD_RETURN theExecutiveBranch (void *args) #if defined(__linux__) // Use the POSIX syscalls to get // the real thread ID (gettid) on Linux machine + #ifndef __ANDROID__ thread->tid = (long) syscall(SYS_gettid); + #else + thread->tid = 0; + #endif #endif // c++11 std::thread, pthread and ace threads on some platforms do not