lockf函数说明

来源:百度知道 编辑:UC知道 时间:2024/05/29 20:04:20
在做操作系统的作业。想问关于lockf函数的具体说明。(在linux环境下)

头文件
#include <sys/file.h>

函数:
int lockf(int fd, int cmd, off_t len);
fd -- 文件id.

fcntl(2)的接口(inteface)函数

返回1 表示调用lockf成功.

lockf用于锁定或打开锁定一个共享文件.

操作有:
F_LOCK(锁定),F_TLOCK,F_ULOCK(打开锁定),F_TEST

详见:
http://linux.about.com/library/cmd/blcmdl3_lockf.htm