-C Added\sadditional\stestcases\sfor\sjulianday\scalculations\swith\smidnight\sboundary\sfor\sUTC\stime.\s(CVS\s5209)
-D 2008-06-12T05:16:15
+C Copy\sthe\slatest\sVFS\schanges\sinto\sthe\sOS/2\simplementation.\s\sThis\sis\sa\sblind\nedit\s-\sI\shave\sno\sway\sto\scompile\sor\stest\sOS/2.\s(CVS\s5210)
+D 2008-06-12T12:38:10
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in ce92ea8dc7adfb743757794f51c10d1b0d9c55e4
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os.c 284abcb97ffdaf5f0b08fa4c5fe1fe93dd86b416
F src/os.h c9a7f94e80193fd4cf27f5c5698eb56753f1b05a
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
-F src/os_os2.c ae37c5971e8b0cfc77e6bf685aa9dd43414208d8
+F src/os_os2.c 6cc3ff5e934eecfa078b5b7bf1d0bdc7ac3f5a2e
F src/os_unix.c 47936aee8265e482faa626141d97d896aa981ef4
F src/os_win.c 0d975b131b2b104d6d69d9f16bdf3c8cec28e81d
F src/pager.c be98ceeb55bbcda9251c1a846d28c3d323885708
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 0729f5c3d01200190897488f14aec413a5ea17f9
-R 13b984f0768ebaa40b5c7e286a6869c0
-U shane
-Z 48e7b28e9864381656e53aa34872ff8b
+P edd2cb00ae606858d8ae138c69eee7821b8cd6ea
+R 5a214bbf9c201a500d01a02d59ac7033
+U drh
+Z bad3ab7e73e6a175cb3c0e9aefbda043
**
** This file contains code that is specific to OS/2.
**
-** $Id: os_os2.c,v 1.41 2008/06/12 02:16:45 shane Exp $
+** $Id: os_os2.c,v 1.42 2008/06/12 12:38:10 drh Exp $
*/
#include "sqliteInt.h"
** file by this or any other process. If such a lock is held, return
** non-zero, otherwise zero.
*/
-int os2CheckReservedLock( sqlite3_file *id ){
+int os2CheckReservedLock( sqlite3_file *id, int *pOut ){
int r = 0;
os2File *pFile = (os2File*)id;
assert( pFile!=0 );
r = !(rc == NO_ERROR);
OSTRACE3( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r );
}
- return r;
+ *pOut = r;
+ return SQLITE_OK;
}
/*
** The next block of code implements the VFS methods.
****************************************************************************/
+/*
+** Create a temporary file name in zBuf. zBuf must be big enough to
+** hold at pVfs->mxPathname characters.
+*/
+static int getTempname(int nBuf, char *zBuf ){
+ static const unsigned char zChars[] =
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789";
+ int i, j;
+ char zTempPathBuf[3];
+ PSZ zTempPath = (PSZ)&zTempPathBuf;
+ char *zTempPathUTF;
+ if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
+ if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
+ if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
+ ULONG ulDriveNum = 0, ulDriveMap = 0;
+ DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
+ sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
+ }
+ }
+ }
+ /* strip off a trailing slashes or backslashes, otherwise we would get *
+ * multiple (back)slashes which causes DosOpen() to fail */
+ j = strlen(zTempPath);
+ while( j > 0 && ( zTempPath[j-1] == '\\' || zTempPath[j-1] == '/' ) ){
+ j--;
+ }
+ zTempPath[j] = '\0';
+ zTempPathUTF = convertCpPathToUtf8( zTempPath );
+ sqlite3_snprintf( nBuf-30, zBuf,
+ "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );
+ free( zTempPathUTF );
+ j = strlen( zBuf );
+ sqlite3_randomness( 20, &zBuf[j] );
+ for( i = 0; i < 20; i++, j++ ){
+ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
+ }
+ zBuf[j] = 0;
+ OSTRACE2( "TEMP FILENAME: %s\n", zBuf );
+ return SQLITE_OK;
+}
+
+
/*
** Open a file.
*/
APIRET rc = NO_ERROR;
ULONG ulAction;
char *zNameCp;
+ char zTmpname[MAX_PATH+1]; /* Buffer to hold name of temp file */
+
+ /* If the second argument to this function is NULL, generate a
+ ** temporary file name to use
+ */
+ if( !zName ){
+ int rc = getTempname(MAX_PATH+1, zTmpname);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+ zName = zTmpname;
+ }
+
memset( pFile, 0, sizeof(*pFile) );
static int os2Access(
sqlite3_vfs *pVfs, /* Not used on os2 */
const char *zFilename, /* Name of file to check */
- int flags /* Type of test to make on this file */
+ int flags, /* Type of test to make on this file */
+ int *pOut /* Write results here */
){
FILESTATUS3 fsts3ConfigInfo;
APIRET rc = NO_ERROR;
default:
assert( !"Invalid flags argument" );
}
- return rc;
-}
-
-
-/*
-** Create a temporary file name in zBuf. zBuf must be big enough to
-** hold at pVfs->mxPathname characters.
-*/
-static int os2GetTempname( sqlite3_vfs *pVfs, int nBuf, char *zBuf ){
- static const unsigned char zChars[] =
- "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "0123456789";
- int i, j;
- char zTempPathBuf[3];
- PSZ zTempPath = (PSZ)&zTempPathBuf;
- char *zTempPathUTF;
- if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
- if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
- if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
- ULONG ulDriveNum = 0, ulDriveMap = 0;
- DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
- sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
- }
- }
- }
- /* strip off a trailing slashes or backslashes, otherwise we would get *
- * multiple (back)slashes which causes DosOpen() to fail */
- j = strlen(zTempPath);
- while( j > 0 && ( zTempPath[j-1] == '\\' || zTempPath[j-1] == '/' ) ){
- j--;
- }
- zTempPath[j] = '\0';
- zTempPathUTF = convertCpPathToUtf8( zTempPath );
- sqlite3_snprintf( nBuf-30, zBuf,
- "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );
- free( zTempPathUTF );
- j = strlen( zBuf );
- sqlite3_randomness( 20, &zBuf[j] );
- for( i = 0; i < 20; i++, j++ ){
- zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
- }
- zBuf[j] = 0;
- OSTRACE2( "TEMP FILENAME: %s\n", zBuf );
+ *pOut = rc;
return SQLITE_OK;
}
+
/*
** Turn a relative pathname into a full pathname. Write the full
** pathname into zFull[]. zFull[] will be at least pVfs->mxPathname
os2Open, /* xOpen */
os2Delete, /* xDelete */
os2Access, /* xAccess */
- os2GetTempname, /* xGetTempname */
os2FullPathname, /* xFullPathname */
os2DlOpen, /* xDlOpen */
os2DlError, /* xDlError */
os2Randomness, /* xRandomness */
os2Sleep, /* xSleep */
os2CurrentTime /* xCurrentTime */
+ os2GetLastError /* xGetLastError */
};
return &os2Vfs;