/ Check-in [5f682c9a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix most remaining testsuite failures on OS/2 by switching to exclusive locks that we meant to use from the start. (CVS 5092)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5f682c9a68853f33aac6a2ad3f91b1cdf17dcd73
User & Date: pweilbacher 2008-05-06 22:22:11
Context
2008-05-07
02:42
Only look for config.h if the autoconf-based build is being used, and don't inline it into the amalgamation. (CVS 5093) check-in: 7df9ef2c user: mlcreech tags: trunk
2008-05-06
22:22
Fix most remaining testsuite failures on OS/2 by switching to exclusive locks that we meant to use from the start. (CVS 5092) check-in: 5f682c9a user: pweilbacher tags: trunk
22:15
The pathToDel element of the os2File structure should be in the local codepage instead of UTF-8 to make DosForceDelete() work. (CVS 5091) check-in: 76028b5e user: pweilbacher tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_os2.c.

   313    313       int cnt = 3;
   314    314   
   315    315       LockArea.lOffset = PENDING_BYTE;
   316    316       LockArea.lRange = 1L;
   317    317       UnlockArea.lOffset = 0L;
   318    318       UnlockArea.lRange = 0L;
   319    319   
   320         -    while( cnt-->0 && ( res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L) )
          320  +    while( cnt-->0 && ( res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L ) )
   321    321                         != NO_ERROR
   322    322       ){
   323    323         /* Try 3 times to get the pending lock.  The pending lock might be
   324    324         ** held by another reader process who will release it momentarily.
   325    325         */
   326    326         OSTRACE2( "LOCK could not get a PENDING lock. cnt=%d\n", cnt );
   327    327         DosSleep(1);
................................................................................
   347    347     */
   348    348     if( locktype==RESERVED_LOCK && res == NO_ERROR ){
   349    349       assert( pFile->locktype==SHARED_LOCK );
   350    350       LockArea.lOffset = RESERVED_BYTE;
   351    351       LockArea.lRange = 1L;
   352    352       UnlockArea.lOffset = 0L;
   353    353       UnlockArea.lRange = 0L;
   354         -    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          354  +    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   355    355       if( res == NO_ERROR ){
   356    356         newLocktype = RESERVED_LOCK;
   357    357       }
   358    358       OSTRACE3( "LOCK %d acquire reserved lock. res=%d\n", pFile->h, res );
   359    359     }
   360    360   
   361    361     /* Acquire a PENDING lock
................................................................................
   372    372       assert( pFile->locktype>=SHARED_LOCK );
   373    373       res = unlockReadLock(pFile);
   374    374       OSTRACE2( "unreadlock = %d\n", res );
   375    375       LockArea.lOffset = SHARED_FIRST;
   376    376       LockArea.lRange = SHARED_SIZE;
   377    377       UnlockArea.lOffset = 0L;
   378    378       UnlockArea.lRange = 0L;
   379         -    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          379  +    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   380    380       if( res == NO_ERROR ){
   381    381         newLocktype = EXCLUSIVE_LOCK;
   382    382       }else{
   383    383         OSTRACE2( "OS/2 error-code = %d\n", res );
   384    384         getReadLock(pFile);
   385    385       }
   386    386       OSTRACE3( "LOCK %d acquire exclusive lock.  res=%d\n", pFile->h, res );
................................................................................
   391    391     */
   392    392     if( gotPendingLock && locktype==SHARED_LOCK ){
   393    393       int r;
   394    394       LockArea.lOffset = 0L;
   395    395       LockArea.lRange = 0L;
   396    396       UnlockArea.lOffset = PENDING_BYTE;
   397    397       UnlockArea.lRange = 1L;
   398         -    r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          398  +    r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   399    399       OSTRACE3( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r );
   400    400     }
   401    401   
   402    402     /* Update the state of the lock has held in the file descriptor then
   403    403     ** return the appropriate result code.
   404    404     */
   405    405     if( res == NO_ERROR ){
................................................................................
   432    432       APIRET rc = NO_ERROR;
   433    433       memset(&LockArea, 0, sizeof(LockArea));
   434    434       memset(&UnlockArea, 0, sizeof(UnlockArea));
   435    435       LockArea.lOffset = RESERVED_BYTE;
   436    436       LockArea.lRange = 1L;
   437    437       UnlockArea.lOffset = 0L;
   438    438       UnlockArea.lRange = 0L;
   439         -    rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          439  +    rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   440    440       OSTRACE3( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc );
   441    441       if( rc == NO_ERROR ){
   442    442         APIRET rcu = NO_ERROR; /* return code for unlocking */
   443    443         LockArea.lOffset = 0L;
   444    444         LockArea.lRange = 0L;
   445    445         UnlockArea.lOffset = RESERVED_BYTE;
   446    446         UnlockArea.lRange = 1L;
   447         -      rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          447  +      rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   448    448         OSTRACE3( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu );
   449    449       }
   450    450       r = !(rc == NO_ERROR);
   451    451       OSTRACE3( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r );
   452    452     }
   453    453     return r;
   454    454   }
................................................................................
   478    478     OSTRACE4( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype );
   479    479     type = pFile->locktype;
   480    480     if( type>=EXCLUSIVE_LOCK ){
   481    481       LockArea.lOffset = 0L;
   482    482       LockArea.lRange = 0L;
   483    483       UnlockArea.lOffset = SHARED_FIRST;
   484    484       UnlockArea.lRange = SHARED_SIZE;
   485         -    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          485  +    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   486    486       OSTRACE3( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res );
   487    487       if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){
   488    488         /* This should never happen.  We should always be able to
   489    489         ** reacquire the read lock */
   490    490         OSTRACE3( "UNLOCK %d to %d getReadLock() failed\n", pFile->h, locktype );
   491    491         rc = SQLITE_IOERR_UNLOCK;
   492    492       }
   493    493     }
   494    494     if( type>=RESERVED_LOCK ){
   495    495       LockArea.lOffset = 0L;
   496    496       LockArea.lRange = 0L;
   497    497       UnlockArea.lOffset = RESERVED_BYTE;
   498    498       UnlockArea.lRange = 1L;
   499         -    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          499  +    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   500    500       OSTRACE3( "UNLOCK %d reserved res=%d\n", pFile->h, res );
   501    501     }
   502    502     if( locktype==NO_LOCK && type>=SHARED_LOCK ){
   503    503       res = unlockReadLock(pFile);
   504    504       OSTRACE5( "UNLOCK %d is %d want %d res=%d\n", pFile->h, type, locktype, res );
   505    505     }
   506    506     if( type>=PENDING_LOCK ){
   507    507       LockArea.lOffset = 0L;
   508    508       LockArea.lRange = 0L;
   509    509       UnlockArea.lOffset = PENDING_BYTE;
   510    510       UnlockArea.lRange = 1L;
   511         -    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );
          511  +    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 0L );
   512    512       OSTRACE3( "UNLOCK %d pending res=%d\n", pFile->h, res );
   513    513     }
   514    514     pFile->locktype = locktype;
   515    515     OSTRACE3( "UNLOCK %d now %d\n", pFile->h, pFile->locktype );
   516    516     return rc;
   517    517   }
   518    518