61 questions
2
votes
1
answer
108
views
Why does Bionic's sem_post implementation wake all waiters instead of just one?
I'm having performance issues on Android when sem_posting on a contended semaphore with a somewhat large number of (pshared) waiters.
What I'm trying to do is to spawn a large number of processes, ...
0
votes
1
answer
110
views
How can I get number of cores on android bionic uapi?
Android bionic defines a series of structs that are used specifically to handle kernel level
uapi data, like sysinfo.h header which defines a struct called sysinfo that defines registers for kernel &...
4
votes
1
answer
288
views
Hook setenv(), getenv() using C code during runtime to make them thread safe [closed]
As it is already painfully known, modifying the process environment in a multi-threaded application during runtime is asking for trouble. However, not always we can control who accesses that.
In this ...
-1
votes
1
answer
374
views
What is __LIBC_HIDDEN__ in C header?
Introduction
In a log output of a crash, there is an error with backtrace output as:
#00 pc 00038cf0 /apex/com.android.runtime/lib/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, ...
2
votes
1
answer
2k
views
Can we use glibc instead of Bionic in Android?
Considering No licensing issue, enough memory and processing power can we switch back to glibc for Android from Bionic?
What are those functionalities are there in bionic which are not available with ...
1
vote
1
answer
313
views
Why Bionic C runtime library in Android does not support "%n" format in printf function?
According to ISO C standard (ISO/IEC 9899), printf function contains "%n" format to count the number of output characters.
n: The argument shall be a pointer to signed integer into which is ...
6
votes
2
answers
2k
views
How to symbolicate libart.so or libc.so stacktraces in Crashlytics Android NDK?
Note: Symbols are showing up in crashlytics for our c++ library, the problem is that they aren't showing for system libraries like libc, libart, libbase, and libandroid_runtime.
We have some tricky ...
5
votes
1
answer
3k
views
Where is the Android libc documentation?
For glibc you can find an online documentation here.
I am looking for an equivalent documentation for Android's libc implementation (headers located under sysroot/usr/include).
Is there a ...
2
votes
1
answer
355
views
How to use shared library from Android on Raspberry Pi
I have closed-source shared library originally built for Android which I want to use on Raspberry Pi. The problem is this:
/usr/bin/ld: /usr/lib/libfoo.so: undefined reference to `__cxa_atexit@LIBC'
/...
0
votes
1
answer
330
views
How to implement crypt() and wordexp.h in Android Posix
I know that these 2 functionalities are not provided by Bionics libc implementation. I do need these for a C++ to Android port. How can I solve this problem? I dont know where to start here.
I get ...
0
votes
0
answers
107
views
Android NDK - Symbol __sfp and __sflag are not compatible with 64bit
Application is supporting to 32bit. Facing issue while migrating from 32bit (armeabi-v7a) to 64bit (arm64-v8a).
Issue - assertion "orig___sfp" failed
In project, using two symbol __sfp and ...
1
vote
1
answer
883
views
Does NDK support C++14?
Currently working on something where I need to develop some feature using C++14, but still wondering on whether it can be supported by Bionic & NDK??
From Bionic Wiki Status, C++11 featureshas ...
1
vote
1
answer
1k
views
android libuv use of undeclared identifier 'EPOLL_CLOEXEC'
i'm trying to build libuv for android in android studio cmake and i get the following errors:
error: use of undeclared identifier 'EPOLL_CLOEXEC'
warning: implicit declaration of function '...
0
votes
0
answers
104
views
Which functions in the Android Bionic grant access to hardware (camera, microphone, etc.)?
I am writing a code that requires changing the functions in the Bionic that access resources such as the camera, microphone, location, contacts, and more (for academic research purposes).
I am having ...
0
votes
0
answers
318
views
pthread_mutex_t in bionic libc
I am trying to port a code that uses glibc into Android NDK and running into some issues related to mutexes. Currently our code uses mutex.__data.__count to cycle through all the locks, and release ...
3
votes
0
answers
456
views
Cross-compiling of C code for Android
I cross-compiled my C application for Android ARM with arm-linux-gnueabi tool under Ubuntu 16.04 LTS. I compiled it with static linking flag. This C application is big and it has complicated makefile. ...
0
votes
1
answer
488
views
Analogue of LD_DEBUG for zygote-spawned process
I'm wondering if Android has an option for user to enable LD_DEBUG-style logs for Zygote-spawned processes. Probably we can not start app_process for Zygote with customized environment without being a ...
1
vote
1
answer
558
views
Is there no pthread library in bionic libc?
I'm using a toolchain to cross compile some library which is dependent on lpthread for android. It had bionic version of libc. It says lpthred cannot be found and there is no libpthread.so to be found ...
2
votes
0
answers
465
views
sendmsg socket system call parameters in bionic libc (android)
I was going through the bionic libc socket system calls and noticed something confusing. The android/bionic/libc/include/sys/socket.h has a system call declaration for sendmsg as
__socketcall int ...
1
vote
1
answer
240
views
How to get uid in bionic libc?
I am trying to get the uid of the process calling dns files in bionic libc. I know using current->cred->uid.val is used to get the uid in android/linux kernel, but how to get the uid in bionic libc. I ...
0
votes
1
answer
676
views
Order of proc/pid/maps entries
So each entry in maps file has start and end addresses where they were mmap'ed. If a library is dynamically loaded (maybe using dlopen()), would the addresses of previous entries be affected in any ...
1
vote
1
answer
310
views
Why only static build run on Android?
I build some applications for android without using Android studio & NDK.
I've noticed that if I build them without "-static" arguments, then Android fails to run them.
I could not find the ...
1
vote
0
answers
153
views
Bionic toolchain ld relocatable object file issue
I'm trying to cross-compile for Arm-android the GRPC C++, during the linking of some libraries I've got these errors from ld:
arm-linux-androideabi-ld: error: /grpc/objs/opt/src/cpp/client/...
1
vote
1
answer
2k
views
Bionic and libc’s stub implementations
I’d like to run an x86 shared library that I grabbed from an apk on a non-android linux machine.
It’s linked against android libc, so I grabbed the libc.so from the android ndk.
After debugging ...
0
votes
0
answers
405
views
Issue in adding syscalls in Android libc
Please help.
I'm working with Android marshmallow (6.0) source code and I need a linux message queue and shared memory related system call support for an application to port. Formerly I was using ...
6
votes
2
answers
1k
views
Compiling gentoo-bionic on a x86_64 linux machine
As you may know, Bionic is a C library used by Google to run Android applications. There are efforts to compile it in Linux machines, so it could be easily used outside Android. This is the code from ...
2
votes
2
answers
712
views
How to stop android system and launch a particular application in Android
I have written an application in C, statically linked without using any android services or framework. It just uses API provided by kernel and libc. I want to stop all android services, framework and ...
2
votes
1
answer
3k
views
How to add libc to android application?
I am writing a C code which I wish to run in android using ndk. I have glibc library in the code which as I understood is difficult to port directly. Hence I tried to use libc instead from the bionic ...
1
vote
0
answers
251
views
Missing functions in Bionic
Im cross compiling haskell to run on Android. After some days of struggling my only remaining problem is that libc on Android (Bionic) is missing some functions found in glibc. More precisely ...
2
votes
0
answers
801
views
Using a new method in latest Android NDK libc
I'm using the latest version of the NDK (as of a few weeks ago), r10d, and using the build tools to build python and some extensions in python. Using the build tools, I create a shared object that ...
1
vote
1
answer
830
views
Examining alternate signal stack (Different ways to allocate it)
I am experimenting on alternate signal stack(man sigaltstack).
Two pieces of code allocating stack differently:
int method1(void)
{
struct sigaction act, oldact;
memset(&act, 0, sizeof(...
1
vote
2
answers
778
views
Process-shared mutexes and conditional variables in Android
Does Android support process-shared mutexes and condition variables?
I've heard bionic implementation doesn't support them because Android has other means of IPC, but cannot find information that ...
0
votes
1
answer
420
views
Segfault when accessing char[]
I've got a function
int foo() {
...
char* real_path_buffer = (char*)malloc(sizeof(char)*PATH_MAX);
realpath("a/certain/path/that/doesnt/exist", real_path_buffer);
...
}
That makes a ...
3
votes
0
answers
643
views
How to spawn a new process through Android's libc
I have a cross platform library and use posix_spawn from libc to spawn new processes on Linux'y environments. However this is not included in the Bionic libc library included on Android. Is there an ...
-1
votes
1
answer
131
views
What the meaning of "0x48151642" in malloc_debug_leak.cpp
Recently, I'm reading the libc-init code of android. When I read the code in malloc_debug_leak.cpp, line 70 and line 263, it said as follows.
#define GUARD 0x48151642
static uint32_t ...
1
vote
1
answer
1k
views
Android Bionic and Libc libraries
I want to create small command interpreter for android (shell). It should perform only few features : 'scanf','printf','cd', 'pwd', 'echo','set', 'unset', 'exit' and should support internal path ...
10
votes
3
answers
903
views
Thread safety in Android libraries
I'm trying to implement a native shared library(.so) for the Android system. Naturally, there are some code blocks that need to be thread-safe.
I found out here that pthreads locks, mutexes, or ...
2
votes
4
answers
9k
views
reset sigaction to default
In Android the bionic loader sets a default signal handler for every process on statrtup:
void debugger_init()
{
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_sigaction = ...
3
votes
1
answer
2k
views
statically linking c file with android bionic c library
I just wrote a small c file and its header file.
dev_access.c and dev_access.h
I want to link it to the bionic library in android and create a statically/dynamically linked archive file.
My files ...
1
vote
1
answer
1k
views
ualarm() equivalent (Android Bionic libc)
ualarm() is not implemented in Android version of libc, bionic (check Bionic unistd.h). Moreover, ualarm() is obsolete.
I am porting an application on Android NDK so I need an equivalent of ualarm(...
3
votes
1
answer
2k
views
How to work around absence of futimes() in android (NDK)?
I have large project which needs futimes or futimens function. Unfortunately there are no such functions in header files in android ndk include folder. Is there a work-around (stub or simple code ...
0
votes
2
answers
1k
views
dlopen() fails on Android but works on Linux
I'm trying to dynamically load a specific shared library using dlopen() in lazy mode.
There are of course unresolved symbols in the shared library, but the lazy mode supposed to ignore them.
It does ...
1
vote
2
answers
1k
views
rand() function Bionic vs glibc
I found that rand() function from bionic does't work without including stdlib.h
extern int rand(void);
static void foo()
{
int a = rand();
}
int main()
{
foo()
return 0;
}
Results for glibc:...
1
vote
1
answer
3k
views
Rebuilding part of Android (libc)
I've downloaded sources from http://source.android.com, and build them as in instruction.
But now I want to rebuild only Bionic libc.
Is it possible, without full build process?
1
vote
2
answers
643
views
dalvik segfault on embedded linux
all. I'm trying to get dalvikVM running on embedded linux. I use xilinx-linux for zynq-zc702 running on qemu.
I followed this tutorial:
http://www.bolatdinc.com/?p=336&cpage=1
I ported ashmem ...
2
votes
1
answer
408
views
Minimal set of files required to build Android's bionic
I made some changes to Android's bionic in order to run it with a specific application. I'd like to keep these modifications in my source control (SVN). Any idea what the minimal set of files required ...
2
votes
0
answers
231
views
How can I use Standard C libraries that are not supported in the Bionic C library to build with Android-NDK?
My native source makes use of complex operations (defining ). These operations are implemented in the standard C99 math library but not in the bionic math library used by Android-NDK.
For this reason ...
2
votes
1
answer
617
views
Using time(NULL) on Android
Is there any known problem with using time(NULL) on Android?
I tried running the following piece of code:
int32_t now1 = time(NULL);
int64_t now1_6 = (int64_t)time(NULL);
int32_t nt = (time_t)-1;
...
4
votes
2
answers
562
views
atexit() function bionic vs glibc
I found interesting moment: the atexit() function works differently for bionic and glibc. Here is an example:
#include <cstdlib>
#include <cstdio>
extern "C" {
void one(){
printf("...
2
votes
1
answer
4k
views
Difference between glibC and bioniC
Hi i have some problems with optimization.
I tried to compile one of gcc test with builtin functions:
#include <stdio.h>
#ifdef HAVE_C99_RUNTIME
double test1 (double x)
{
return ...