int QLockFilePrivate::checkFcntlWorksAfterFlock() { QTemporaryFile file; if (!file.open()) return -2; const int fd = file.d_func()->engine()->handle(); if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs return -3; struct flock flockData; flockData.l_type = F_WRLCK; flockData.l_whence = SEEK_SET; flockData.l_start = 0; flockData.l_len = 0; // 0 = entire file flockData.l_pid = getpid(); if (fcntl(fd, F_SETLK, &flockData) == -1) // for networked filesystems return 0; return 1; }