开发者

Implementation of lockf() for android NDK

The Android NDK lacks the lockf() function. While I开发者_如何学JAVA 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


This is how another Google produce handles it

// The lockf() function is not available on Android; we translate to flock().
#define F_LOCK LOCK_EX
#define F_ULOCK LOCK_UN
inline int lockf(int fd, int cmd, off_t ignored_len) {
    return flock(fd, cmd);
}

https://src.chromium.org/svn/branches/1312/src/base/os_compat_android.h


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜