Displaying 1 result from an estimated 1 matches for "the_lock".
Did you mean:
tdb_lock
2007 Jan 22
0
checking a locked file
...ed checking posix byte ranges, posix locking, and kernel op locks.
Here is my test program:
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
/* kernel op locks */
#define F_GETLEASE 1025
int main(int argc, char **argv)
{
struct flock the_lock;
int f;
int retlck;
int smblck;
if(argc != 2) {
fprintf(stdout, "Usage: %s <file>\n", argv[0]);
return 1;
}
f = open(argv[1], O_RDONLY);
the_lock.l_type = F_WRLCK;
the_lock.l_whence = SEEK_SET;
the_lock.l_start = 0;
the_lock.l_len = 0;
if(f <= 0) {
fprin...