Changeset 840 for trunk/server/lib/tdb/common/lock.c
- Timestamp:
- Feb 4, 2014, 4:58:40 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/tdb/common/lock.c
r834 r840 34 34 35 35 static int fcntl_lock(struct tdb_context *tdb, 36 int rw, off_t off, off_t len, bool waitflag)36 int rw, tdb_off_t off, size_t len, bool waitflag) 37 37 { 38 38 struct flock fl; … … 48 48 fl.l_pid = 0; 49 49 50 #ifdef __OS2__ 51 int cmd = 0; 52 if (waitflag) 53 cmd = F_SETLKW; 54 else 55 cmd = F_SETLK; 56 57 int rc = fcntl(tdb->fd, cmd, &fl); 58 // if the first lock doesn't work and it's a complete lock, 59 // we split it in 2 parts. first hash size*4 and then the rest 60 if (rc != 0 && off == FREELIST_TOP && len == 0) { 61 fl.l_len = tdb->header.hash_size * 4; 62 rc = fcntl(tdb->fd, cmd, &fl); 63 if (rc == 0) { 64 fl.l_start = off + tdb->header.hash_size * 4; 65 fl.l_len = LONG_MAX; 66 rc = fcntl(tdb->fd, cmd, &fl); 67 } 68 } 69 return rc; 70 #else 50 71 if (waitflag) 51 72 return fcntl(tdb->fd, F_SETLKW, &fl); 52 73 else 53 74 return fcntl(tdb->fd, F_SETLK, &fl); 54 } 55 56 static int fcntl_unlock(struct tdb_context *tdb, int rw, off_t off, off_t len) 75 #endif 76 } 77 78 static int fcntl_unlock(struct tdb_context *tdb, int rw, tdb_off_t off, size_t len) 57 79 { 58 80 struct flock fl; … … 248 270 while (count--) { 249 271 struct timeval tv; 272 #ifdef __OS2__ 273 // we need to remove locks, as upgrade doesn't work 274 tdb_brunlock(tdb, F_RDLCK, FREELIST_TOP, 0); 275 #endif 250 276 if (tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0, 251 277 TDB_LOCK_WAIT|TDB_LOCK_PROBE) == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.