Changeset 2678

Show
Ignore:
Timestamp:
02/16/08 23:09:30 (9 months ago)
Author:
dhozac
Message:

Use lockf instead of flock, the former works on NFS.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib_internal/util-lockfile.c

    r1616 r2678  
    6262  } 
    6363 
    64   errstr = "flock()"; 
    65   while (flock(*fd, op)==-1) { 
     64  errstr = "lockf()"; 
     65  while (lockf(*fd, op, 0)==-1) { 
    6666    if ((errno!=EINTR && errno!=EINTR) || alarm_flag) goto err; 
    6767  } 
  • trunk/src/lockfile.c

    r1447 r2678  
    4545            "  3a. 'lockfile' waits until somebody opens the <syncpipe> for reading\n" 
    4646            "  3b. parent (shell) opens the pipe for reading and blocks\n" 
    47             "  4.  'lockfile' calls flock() on the <lockfile>\n" 
     47            "  4.  'lockfile' calls lockf() on the <lockfile>\n" 
    4848            "  5.  'lockfile' closes the <syncpipe>\n" 
    4949            "  6.  parent (shell) unlocks since <syncpipe> is closed\n" 
     
    124124    alarm(MIN(10, MAX(duration,1))); 
    125125     
    126     if (flock(fd,LOCK_EX)==-1) { 
     126    if (lockf(fd,F_LOCK,0)==-1) { 
    127127      if (errno==EINTR) continue; 
    128       perror("lockfile: flock()"); 
     128      perror("lockfile: lockf()"); 
    129129      break; 
    130130    } 
  • trunk/src/secure-mount.c

    r2480 r2678  
    280280  } 
    281281 
    282   if (flock(fd, LOCK_EX)==-1) { 
    283     perror("secure-mount: flock()"); 
     282  if (lockf(fd, F_LOCK, 0)==-1) { 
     283    perror("secure-mount: lockf()"); 
    284284    goto err1; 
    285285  } 
  • trunk/vserver-start/main.c

    r2589 r2678  
    9999  *ptr = '\0'; 
    100100 
    101   if (!lockfile(&fd, tmp, LOCK_EX, 30, &err)) { 
     101  if (!lockfile(&fd, tmp, F_LOCK, 30, &err)) { 
    102102    WRITE_MSG(2, "vserver.start: failed to lock '"); 
    103103    WRITE_STR(2, tmp);