search for: lock_opts

Displaying 1 result from an estimated 1 matches for "lock_opts".

2008 Jan 25
1
Windows share modes and Linux file locking, flock & fcntl
...L; if(argc < 2) { printf("No argument\n"); return 2; } else { filename = argv[1]; } fd = open(filename, O_RDWR); if(-1 == fd) { printf("open() failed\n"); return 1; } { struct flock lock_opts; lock_opts.l_type = F_WRLCK; lock_opts.l_whence = SEEK_SET; lock_opts.l_start = 0; lock_opts.l_len = 0; printf("Trying to lock...\n"); result = fcntl(fd, F_SETLKW, &lock_opts); if(result == -1) { printf(&quo...