android NDK 的 lockf() 实现
Android NDK 缺少 lockf() 函数。 当我使用 Android NDK 编译 CUPS 时,出现了缺少 lockf() 的错误。 因此,需要为 NDK 创建类似于 lockf() 的函数。 请帮助我创建这样的功能。
任何帮助将不胜感激。
PS:我是菜鸟
The Android NDK lacks the lockf() function.
While I was compiling CUPS with Android NDK, the error came of missing lockf().
Hence there is need to create function similar to lockf() for NDK.
Please help me in creating such a function.
Any help will be highly appreciated.
PS:I m a noob
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是另一个 Google 产品的处理方式
https://src.chromium .org/svn/branches/1312/src/base/os_compat_android.h
This is how another Google produce handles it
https://src.chromium.org/svn/branches/1312/src/base/os_compat_android.h
即使您实现了 lockf(),使用它仍然会遇到一些问题,因为 Android 的权限管理受到限制。通常,两个进程不会同时拥有同一目录的读/写权限。我的意思是,您没有目录来放置要锁定的文件。
Even if you implement the lockf() you'll still have some problems using it, because Android has a restricted permission management. Generally two processes won't both have read/write permission on a same directory. I mean, you have no directory to place this file to be locked.