alarm(timeout);
}
- errstr = "flock()";
- while (flock(*fd, op)==-1) {
+ errstr = "lockf()";
+ while (lockf(*fd, op, 0)==-1) {
if ((errno!=EINTR && errno!=EINTR) || alarm_flag) goto err;
}
" 2. 'lockfile' will be called\n"
" 3a. 'lockfile' waits until somebody opens the <syncpipe> for reading\n"
" 3b. parent (shell) opens the pipe for reading and blocks\n"
- " 4. 'lockfile' calls flock() on the <lockfile>\n"
+ " 4. 'lockfile' calls lockf() on the <lockfile>\n"
" 5. 'lockfile' closes the <syncpipe>\n"
" 6. parent (shell) unlocks since <syncpipe> is closed\n"
" 7. 'lockfile' goes into infinite loop\n"
int duration = end_time-time(0);
alarm(MIN(10, MAX(duration,1)));
- if (flock(fd,LOCK_EX)==-1) {
+ if (lockf(fd,F_LOCK,0)==-1) {
if (errno==EINTR) continue;
- perror("lockfile: flock()");
+ perror("lockfile: lockf()");
break;
}
signal(SIGALRM, SIG_IGN);
goto err0;
}
- if (flock(fd, LOCK_EX)==-1) {
- perror("secure-mount: flock()");
+ if (lockf(fd, F_LOCK, 0)==-1) {
+ perror("secure-mount: lockf()");
goto err1;
}
ptr = Xmemcpy(ptr, ".startup", sizeof(".startup"));
*ptr = '\0';
- if (!lockfile(&fd, tmp, LOCK_EX, 30, &err)) {
+ if (!lockfile(&fd, tmp, F_LOCK, 30, &err)) {
WRITE_MSG(2, "vserver.start: failed to lock '");
WRITE_STR(2, tmp);
WRITE_MSG(2, "': ");