Record Locking

int fcntl(int filedes, int cmd, struct flock *ldata);

Untitled

ex)

#include <unistd.h>
#include <fcntl.h>

...

struct flock my_lock;

my_lock.l_type = F_WRLCK;
my_lock.l_whence = SEEK_CUR;
my_lock.l_start = 0;
my_lock.l_len = 512;

fcntl(fd, F_SETLKW, &my_lock);

Untitled

Quiz: fcntl

Untitled