Forcing apps into an abstraction layer from the kernel is good design, preventing kernel quirks from being permanent features. Not using GNU is another design choice which can be debated, but it's completely valid, there's no requirement (moral or otherwise) to use the GNU userland with the Linux kernel. Most embedded devices also eschew the GNU userland by instead using Busybox.
Hey, but at least you can remove the tub whenever you want now.
That is nonsense.
I could easily be completely wrong though.
Yes, Android's fopen() function is indeed an abstraction over the Linux fopen() system call. Android's implementation is part of the Bionic C library, which is Android's custom implementation of the standard C library (libc).
When you call fopen() in Android:
1. You're directly using Bionic's implementation of this standard C library function 2. Bionic ultimately relies on the underlying Linux kernel for actual file operations 3. The function provides the same basic functionality as the standard C library fopen() on other Linux systems
The Bionic library was specifically designed for Android to be more lightweight and optimized for mobile devices compared to the traditional glibc used in most Linux distributions. It maintains the same interface as standard C library functions like fopen() while providing platform-specific optimizations for Android's environment.
Yikes, `fopen` is not a system call...
What you're suggesting is, as someone else said, non-sensical. Phrased without invincible ignorance, it's equivalent to saying, "Android prevents you from creating a new OS kernel to supplant its own control over hardware access," which is true of basically any OS. How helpful or secure would it be if you could make 0 guarantees about how your hardware is used?
You can do direct hardware access through drivers that are integrated/interfaced with the kernel somehow, but this still is not an entirely arbitrary access, and is still going through the kernel in a way.
But, they also give app authors the NDK. How do you think Android knows whether it's libc or your app making a syscall from native code?
It doesn't - you're allowed access to full Linux-land. The syscall numbers and userland EABI for Android are the same as for any other Linux. They use a different `libc` from most GNU/Linux (one of a few places this wonderful turn of phrase actually makes sense) flavors, but this is no different from Alpine Linux using `musl` instead of `glibc` for example.
As such, you can use `musl`, `glibc`, or non-libc based environments (Rust, Zig) on Android without issue. You can run any C you want, either by porting it to `bionic` (most termux apps, although they support glibc now), statically linking your own runtime (Rust, Zig, etc.), or abusing the dynamic linker into making glibc work (termux-glibc, I think).
Yes, but there are strict SELinux policies forbidding you from accessing certain "dangerous" stuff like execve(), which may end up killing native terminal emulators like Termux (despite Android not forbidding dynamic code execution elsewhere, Play Store policies aside).