Reputation: 21
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
Upvotes: 2
Views: 1676
Reputation: 749
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
Upvotes: 2
Reputation: 1
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.
Upvotes: 0