如何获取适用于 Android 的 libcap(Linux 功能库)?
Linux 功能 (libcap.so) 库是否可用于 Android?如果没有,我该如何编译它?
我想使用 sys/capability.h 中与功能相关的 API,它包含在 NDK 中。但是当我尝试调用像 cap_get_proc()
这样的函数时,我收到“未定义的引用”错误。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我想使用这个 api 会远远超出 Android 框架中的约定。它可能适用于某些设备,但不适用于其他设备。
事实上,据我所知,并不能保证 Android 甚至可以在 Linux 下运行。例如,新的黑莓设备运行黑莓的专有操作系统,但仍然运行安卓应用程序。
最后,大多数 Android 设备运行的 Linux 版本是高度精简的版本。它们不包含 Android API 不需要的任何功能。如果 Android 不需要 libcap,则可能不包含它。
也许您可以准确地告诉我们您想要做什么。
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.
这是链接 - https://github.com/sensitivehmu/libcap-for-Android。这是原始的 libcap(从 https://kernel.googlesource 克隆.com/pub/scm/linux/kernel/git/morgan/libcap),支持 android ndk 构建。您现在可以为 Android 构建 libcap.so、setcap 和 getcap。
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.
关于这个主题有很多讨论...谷歌一下:
http ://permalink.gmane.org/gmane.comp.handhelds.android.ndk/4075
Lots of discussion out there on this topic... google around a bit:
http://permalink.gmane.org/gmane.comp.handhelds.android.ndk/4075
这里有人编译并描述:
http://blog.umitproject.org/ 2011/05/libpcap-for-android.html
Here someone compiled it and described:
http://blog.umitproject.org/2011/05/libpcap-for-android.html