MCPcopy Index your code
hub / github.com/RsyncProject/rsync / lock_range

Function lock_range

util1.c:632–643  ·  view source on GitHub ↗

Lock a byte range in a open file */

Source from the content-addressed store, hash-verified

630
631/** Lock a byte range in a open file */
632int lock_range(int fd, int offset, int len)
633{
634 struct flock lock;
635
636 lock.l_type = F_WRLCK;
637 lock.l_whence = SEEK_SET;
638 lock.l_start = offset;
639 lock.l_len = len;
640 lock.l_pid = 0;
641
642 return fcntl(fd,F_SETLK,&lock) == 0;
643}
644
645#define ENSURE_MEMSPACE(buf, type, sz, req) \
646 do { if ((req) > sz) buf = realloc_array(buf, type, sz = MAX(sz * 2, req)); } while(0)

Callers 2

claim_connectionFunction · 0.85
create_pid_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected