fd_unlock.c (317B)
1 /* ISC license. */ 2 3 #include <unistd.h> 4 #include <errno.h> 5 6 #include <skalibs/fcntl.h> 7 #include <skalibs/djbunix.h> 8 9 void fd_unlock (int fd) 10 { 11 struct flock fl = 12 { 13 .l_type = F_UNLCK, 14 .l_whence = SEEK_SET, 15 .l_start = 0, 16 .l_len = 0 17 } ; 18 int e = errno ; 19 fcntl(fd, F_SETLK, &fl) ; 20 errno = e ; 21 }