Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get libcap (Linux capabilities library) for Android?

Are the Linux capabilities (libcap.so) library available for use with Android? If not, how can I compile it?

I would like to use the capabilities-related API in sys/capabilities.h, which is included with the NDK. But when I try to call functions like cap_get_proc(), I get "undefined reference" error.

like image 612
zer0stimulus Avatar asked Sep 02 '25 05:09

zer0stimulus


2 Answers

I would imagine that using this api would go way, way beyond the contract in the Android framework. It might work on some devices, but not on others.

In fact, there's no guarantee, afaik, that Android even runs under Linux. For example, the new Blackberry devices run Blackberry's proprietary OS, but still run Android apps.

Finally, the version of Linux that most Android devices run is a highly-stripped-down version. They didn't include any features that the Android API doesn't need. If Android doesn't need libcap, then it's probably not included.

Perhaps you could tell us exactly what it is you're trying to do.

like image 142
Edward Falk Avatar answered Sep 04 '25 18:09

Edward Falk


Here is the link - https://github.com/scopichmu/libcap-for-Android. This is original libcap (was cloned from https://kernel.googlesource.com/pub/scm/linux/kernel/git/morgan/libcap) with supporting of android ndk build. You can build now libcap.so, setcap and getcap for android.

like image 35
scopichmu Avatar answered Sep 04 '25 17:09

scopichmu