进程1加记录锁
1>锁住1,2,3字节
2>锁住全部字节
进程2用F_GETLK获取记录锁情况(只锁定1>情况下):
iret=0
+========child=======+
0-1 byte is unlock.
2-1 byte is WR lock.
2-2 byte is WR lock.
2-3 byte is WR lock.
3-1 byte is WR lock.
3-2 byte is WR lock.
4-1 byte is unlock.
5-1 byte is unlock.
6-1 byte is unlock.
7-1 byte is unlock.
8-1 byte is unlock.
9-1 byte is unlock.
10-1 byte is unlock.
+======parent========+
0-1 byte is unlock.
2-1 byte is unlock.
2-2 byte is unlock.
2-3 byte is unlock.
2-4 byte is unlock.
3-2 byte is unlock.
6-1 byte is unlock.
进程2用F_GETLK获取记录锁情况(1>,2>都执行情况下):
iret=0 +========child=======+
0-1 byte is WR lock.
2-1 byte is WR lock.
2-2 byte is WR lock.
2-3 byte is WR lock.
3-1 byte is WR lock.
3-2 byte is WR lock.
4-1 byte is WR lock.
5-1 byte is WR lock.
6-1 byte is WR lock.
7-1 byte is WR lock.
8-1 byte is WR lock.
9-1 byte is WR lock.
10-1 byte is WR lock. +======parent========+
0-1 byte is unlock.
2-1 byte is unlock.
2-2 byte is unlock.
2-3 byte is unlock.
2-4 byte is unlock.
3-2 byte is unlock.
6-1 byte is unlock.