#include #include #include #include #include #include int lock_reg(int, int, off_t, int, off_t, int); #define read_lock(fd, offset, whence, len) \ lock_reg(fd, F_RDLCK, offset, whence, len, F_SETLK) #define write_lock(fd, offset, whence, len) \ lock_reg(fd, F_WRLCK, offset, whence, len, F_SETLK) #define un_lock(fd, offset, whence, len) \ lock_reg(fd, F_UNLCK, offset, whence, len, F_SETLK) #define readb_lock(fd, offset, whence, len) \ lock_reg(fd, F_RDLCK, offset, whence, len, F_SETLKW) #define writeb_lock(fd, offset, whence, len) \ lock_reg(fd, F_WRLCK, offset, whence, len, F_SETLKW) #define unb_lock(fd, offset, whence, len) \ lock_reg(fd, F_UNLCK, offset, whence, len, F_SETLKW)