/* ISC license. */ #include #ifdef SKALIBS_HASFLOCK #include #include #include #include int lock_ex (int fd) { int r ; do r = flock(fd, LOCK_EX) ; while ((r == -1) && (errno == EINTR)) ; return r ; } #else #include #include #include #include int lock_ex (int fd) { int r ; do r = lockf(fd, F_LOCK, 0) ; while ((r == -1) && (errno == EINTR)) ; return r ; } #endif