Linux 其中fcntl保存锁定信息 我想知道FCNTL C++函数在哪里保存有关锁定文件的信息。我知道它保存了一些关于/proc/locks的信息,但是即使它被另一台主机锁定,fcntl也会标识lock

Linux 其中fcntl保存锁定信息 我想知道FCNTL C++函数在哪里保存有关锁定文件的信息。我知道它保存了一些关于/proc/locks的信息,但是即使它被另一台主机锁定,fcntl也会标识lock,linux,locking,multiprocessing,fcntl,Linux,Locking,Multiprocessing,Fcntl,在我的第一台主机中,我通过F_WRLCK锁定了一些文件 #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <stdio.h> #include<iostream> main() { int fd; struct flock lock; lock.l_type=F_W

在我的第一台主机中,我通过F_WRLCK锁定了一些文件

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include<iostream>
main() {

    int fd;
    struct flock lock;
    lock.l_type=F_WRLCK;
    lock.l_start=0;
    lock.l_whence= SEEK_SET;
    lock.l_len=0;
    printf("open %d\n",fd=open("/u/embedit/places/scratch/gtevos/ts16nxq42p11assrl16kaa03/ts16nxq42p11assrl16kaa.cpj", O_RDWR ));
    int rc = fcntl(fd, F_SETLK, &lock);
    std::cout<<rc<<std::endl;
    std::cin>>fd;

}
#包括
#包括
#包括
#包括
#包括
#包括
main(){
int-fd;
结构植绒锁;
lock.l_type=F_WRLCK;
lock.l_start=0;
lock.l\u whence=SEEK\u SET;
lock.l_len=0;
printf(“打开%d\n”,fd=open(“/u/embedit/places/scratch/gtevos/ts16nxq42p1assrl16kaa03/ts16nxq42p1assrl16kaa.cpj”,O_RDWR));
int rc=fcntl(fd、F_SETLK和lock);
标准::cout
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include<iostream>
main() {
    int fd;
    struct flock lock;
    lock.l_type=F_RDLCK;
    lock.l_start=0;
    lock.l_whence= SEEK_SET;
    lock.l_len=0;

    printf("open %d\n",fd=open("/u/embedit/places/scratch/gtevos/ts16nxq42p11assrl16kaa03/ts16nxq42p11assrl16kaa.cpj", O_RDONLY ));
    int rc = fcntl(fd, F_SETLK, &lock);
    std::cout<<rc<<std::endl;
    std::cin>>fd;

}