chown(2), setfilecon(3)
int fd = open("/some/path", O_RDWR);
flock(fd, LOCK_EX);
int fd = open("/some/path", O_RDWR);
struct flock fl = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = 1,
.l_len = 2,
};
fcntl(fd, F_SETLKW, &fl);
fork(2)close(2) releases lock
open(2) & close(2)/etc/passwd, getpwent(3))struct flockint fd = open("/some/path", O_RDWR);
lockf(fd, F_LOCK, len);
fcntl(fd, F_SETLK, ...)int fd = open("/some/path", O_RDWR);
struct flock fl = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = 1,
.l_len = 2,
};
fcntl(fd, F_OFD_SETLK, &fl);
close(2)fork(2) & auditingopen, close & pthread locksmprivozn@redhat.com