?? lockopen2.c
字號:
#include "unpipc.h"
#define LOCKFILE "/tmp/seqno.lock"
void
my_lock(int fd)
{
int tempfd;
/* create with O_TRUNC and no permission bits */
while ( (tempfd = open(LOCKFILE, O_CREAT | O_WRONLY | O_TRUNC, 0)) < 0) {
if (errno != EACCES)
err_sys("open error for lock file");
/* someone else has the lock, loop around and try again */
}
Close(tempfd); /* opened the file, we have the lock */
}
void
my_unlock(int fd)
{
Unlink(LOCKFILE); /* release lock by removing file */
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -