in reply to Re^2: fcntl failure after eval
in thread fcntl failure after eval
This does look like the right answer.
There are 3 different cases to consider:
ikegami's c program for each of the three:
$ gcc -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall a.c -o a && a flock: 24 flock.l_type: 2 @ 0 flock.l_whence: 2 @ 2 flock.l_start: 8 @ 4 flock.l_len: 8 @ 12 flock.l_pid: 4 @ 20
$ gcc -Wall a.c -o a && a flock: 16 flock.l_type: 2 @ 0 flock.l_whence: 2 @ 2 flock.l_start: 4 @ 4 flock.l_len: 4 @ 8 flock.l_pid: 4 @ 12
$ gcc -Wall a.c -o a && a flock: 32 flock.l_type: 2 @ 0 flock.l_whence: 2 @ 2 flock.l_start: 8 @ 8 flock.l_len: 8 @ 16 flock.l_pid: 4 @ 24
The test perls:
Changing the op's code to:
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=5, len=0}, 0x9d827d0) = 0 => this probably works by accident
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=5, len=0}, 0x819b4a8) = 0 => this probably works by accident
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=5, len=2314885392840523776}, 0x81ed670) = 0 => the length parameter does not contain the expected value
fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0 => not correct, start is 0 but 'expected' value is 5
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=5, len=2}, 0x970c7d0) = 0
fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=5, len=2}, 0x819b4a8) = 0
fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=8589934592, len=0}) = 0
fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=5, len=2}) = 0
What this all means is that the value you need for $flags depends highly on the system it is running.. Which makes me wonder wheter or not there is a better way to accomplish what the op wants..
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: fcntl failure after eval
by ikegami (Patriarch) on Aug 12, 2011 at 08:30 UTC | |
by flipper (Beadle) on Aug 12, 2011 at 10:13 UTC | |
by Anonymous Monk on Aug 12, 2011 at 10:54 UTC | |
by ikegami (Patriarch) on Aug 12, 2011 at 19:22 UTC | |
by Anonymous Monk on Aug 12, 2011 at 20:12 UTC | |
by ikegami (Patriarch) on Aug 12, 2011 at 20:44 UTC | |
by flipper (Beadle) on Aug 12, 2011 at 10:49 UTC |