Changeset 846 for trunk/server/lib/tdb/common/open.c
- Timestamp:
- Feb 14, 2014, 3:12:09 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/lib/tdb/common/open.c
r834 r846 292 292 goto internal; 293 293 } 294 295 #ifdef __OS2__ 296 if (os2_crtSem(tdb, name, "tdb_open_ex") != 0) 297 goto fail; 298 #endif 294 299 295 300 if ((tdb->fd = open(name, open_flags, mode)) == -1) { … … 470 475 { int save_errno = errno; 471 476 477 #ifdef __OS2__ 478 DosCloseMutexSem(tdb->hActiveLock); 479 tdb->hActiveLock = 0; 480 #endif 472 481 if (!tdb) 473 482 return NULL; … … 538 547 } 539 548 549 #ifdef __OS2__ 550 DosCloseMutexSem(tdb->hActiveLock); 551 tdb->hActiveLock = 0; 552 #endif 553 540 554 #ifdef TDB_TRACE 541 555 close(tdb->tracefd); … … 605 619 #endif /* fake pread or pwrite */ 606 620 621 #ifdef __OS2__ 622 DosCloseMutexSem(tdb->hActiveLock); 623 tdb->hActiveLock = 0; 624 625 if (os2_crtSem(tdb, tdb->name, "tdb_reopen") != 0) 626 goto fail; 627 #endif 607 628 /* We may still think we hold the active lock. */ 608 629 tdb->num_lockrecs = 0; … … 658 679 return 0; 659 680 } 681 #ifdef __OS2__ 682 int os2_crtSem(struct tdb_context *tdb, const char *name, const char *caller) 683 { 684 // name could be null, so handle it 685 if (name == NULL) 686 return -1; 687 688 char szSem[_MAX_PATH]; 689 char drive[_MAX_DRIVE], dir[_MAX_DIR]; 690 char fname[_MAX_FNAME], ext[_MAX_EXT]; 691 APIRET rc; 692 // extract path info 693 _splitpath(name, drive, dir, fname, ext); 694 sprintf(szSem, "\\SEM32\\TDB_AL_%s%s%s", dir, fname, ext); 695 rc = DosCreateMutexSem(szSem, &tdb->hActiveLock, 0, FALSE); 696 if (rc == ERROR_DUPLICATE_NAME) 697 rc = DosOpenMutexSem(szSem, &tdb->hActiveLock); 698 if (rc != NO_ERROR) { 699 TDB_LOG((tdb, TDB_DEBUG_ERROR, "os2_crtSem: cannot create sem32 %s (rc=%d) called from %s\n", 700 szSem, rc, caller)); 701 errno = EINVAL; 702 return -1; 703 } 704 return 0; 705 } 706 #endif
Note:
See TracChangeset
for help on using the changeset viewer.