我是靠谱客的博主 细心黄蜂,最近开发中收集的这篇文章主要介绍linux 串口文件锁,文件锁机制-zishang-hhg-ChinaUnix博客,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

引用

beyes@linux-beyes:~/C> ./lock4.exe

Testing F_WRLCK on region from 0 to 5

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 0 to 5

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 5 to 10

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 5 to 10

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 10 to 15

Lock would fail. F_GETLK returned:

l_type 0, l_whence 0, l_start 10, l_len 20, l_pid 15916

Testing F_RDLCK on region from 10 to 15

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 15 to 20

Lock would fail. F_GETLK returned:

l_type 0, l_whence 0, l_start 10, l_len 20, l_pid 15916

Testing F_RDLCK on region from 15 to 20

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 20 to 25

Lock would fail. F_GETLK returned:

l_type 0, l_whence 0, l_start 10, l_len 20, l_pid 15916

Testing F_RDLCK on region from 20 to 25

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 25 to 30

Lock would fail. F_GETLK returned:

l_type 0, l_whence 0, l_start 10, l_len 20, l_pid 15916

Testing F_RDLCK on region from 25 to 30

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 30 to 35

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 30 to 35

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 35 to 40

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 35 to 40

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 40 to 45

Lock would fail. F_GETLK returned:

l_type 1, l_whence 0, l_start 40, l_len 10, l_pid 15916

Testing F_RDLCK on region from 40 to 45

Lock would fail. F_GETLK return:

l_type 1, l_whence 0, l_start 40, l_len 10, l_pid 15916

Testing F_WRLCK on region from 45 to 50

Lock would fail. F_GETLK returned:

l_type 1, l_whence 0, l_start 40, l_len 10, l_pid 15916

Testing F_RDLCK on region from 45 to 50

Lock would fail. F_GETLK return:

l_type 1, l_whence 0, l_start 40, l_len 10, l_pid 15916

Testing F_WRLCK on region from 50 to 55

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 50 to 55

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 55 to 60

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 55 to 60

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 60 to 65

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 60 to 65

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 65 to 70

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 65 to 70

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 70 to 75

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 70 to 75

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 75 to 80

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 75 to 80

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 80 to 85

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 80 to 85

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 85 to 90

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 85 to 90

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 90 to 95

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 90 to 95

F_RDLCK - Lock would secceed

Testing F_WRLCK on region from 95 to 100

F_WRLCK - Lock would succeed

Testing F_RDLCK on region from 95 to 100

F_RDLCK - Lock would secceed

最后

以上就是细心黄蜂为你收集整理的linux 串口文件锁,文件锁机制-zishang-hhg-ChinaUnix博客的全部内容,希望文章能够帮你解决linux 串口文件锁,文件锁机制-zishang-hhg-ChinaUnix博客所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部