From 6a9773e88423672078011b1833e17361b62a4485 Mon Sep 17 00:00:00 2001 From: pweilbacher Date: Wed, 18 Jun 2008 21:08:16 +0000 Subject: [PATCH] fix OS/2 files to compile again (looking at Windows equivalents for guidance) (CVS 5239) FossilOrigin-Name: 8b14a220f261b354e7d2d16dc3fe30c5d3d34143 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/mutex_os2.c | 37 +++++++++++++++++++++++++++---------- src/os_os2.c | 12 ++++++++---- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/manifest b/manifest index 8eedd4f78a..a3d2f0dd97 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\spublic\sAPIs\ssqlite3_mutex_init()\sand\ssqlite3_mutex_end().\sThis\scommit\sonly\schanges\sthe\scode,\sdocumentation\sis\snot\supdated\syet.\s(CVS\s5238) -D 2008-06-18T18:57:42 +C fix\sOS/2\sfiles\sto\scompile\sagain\s(looking\sat\sWindows\sequivalents\sfor\sguidance)\s(CVS\s5239) +D 2008-06-18T21:08:16 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in dc5608df93faf4406cfd7a1c8ed9ab93d8bfbfd5 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -125,13 +125,13 @@ F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909 F src/mem5.c ad31a0a481b86b86f4ac0b6d952e69727d4e113a F src/mutex.c 67393ac4e82d2ff09622ec33b9f289deb9d8825e F src/mutex.h 62ce61355b7a10a7c262e71aa9ed848a945a9353 -F src/mutex_os2.c b8c1231319e966875f251a7ec137bea353546b87 +F src/mutex_os2.c d9eb88ad198c59f1a45d90b597c258562a40e52c F src/mutex_unix.c 469a35c105435794375d683f75cad9e848817d19 F src/mutex_w32.c e03baa369c5e8e7ea4dd2e5b3d098e047f7a2f06 F src/os.c e9f37351dc4aacc4861f0adbe463f21c8f5969fa F src/os.h c9a7f94e80193fd4cf27f5c5698eb56753f1b05a F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 -F src/os_os2.c 9f74147f1899793a106827f6bc770363ec377912 +F src/os_os2.c 9dc031a31ec631c4b2ee3bc2f8b2533b36f20376 F src/os_unix.c b8c07b0cd85c9909000740dc3f29ce938091b00c F src/os_win.c 0b90d9a1ce18bfd2a5f3c4a6bdb13ec369c805a9 F src/pager.c 2f5f55a9405a17240adede9e3b671778fb9a4978 @@ -597,7 +597,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 383a78601c70cd832c171344857038e345b9ae5c -R 5a539d7ef3411d43e2d6012463f4a2ce -U danielk1977 -Z cdfd3ad673652b86380543a46b5ea0f7 +P 42a2a8f49324e2e07b81fd08e24f636a2d98a961 +R e6e96da06a6e46fe7a401745505f409f +U pweilbacher +Z 5510fdf0cc10dd25a8cc1f913a04d5af diff --git a/manifest.uuid b/manifest.uuid index 7e7435cac6..470323e1ba 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -42a2a8f49324e2e07b81fd08e24f636a2d98a961 \ No newline at end of file +8b14a220f261b354e7d2d16dc3fe30c5d3d34143 \ No newline at end of file diff --git a/src/mutex_os2.c b/src/mutex_os2.c index dd1894d24a..d2a96e0219 100644 --- a/src/mutex_os2.c +++ b/src/mutex_os2.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains the C functions that implement mutexes for OS/2 ** -** $Id: mutex_os2.c,v 1.7 2008/06/13 18:24:27 drh Exp $ +** $Id: mutex_os2.c,v 1.8 2008/06/18 21:08:16 pweilbacher Exp $ */ #include "sqliteInt.h" @@ -42,8 +42,8 @@ struct sqlite3_mutex { /* ** Initialize and deinitialize the mutex subsystem. */ -int sqlite3_mutex_init(void){ return SQLITE_OK; } -int sqlite3_mutex_end(void){ return SQLITE_OK; } +int os2MutexInit(void){ return SQLITE_OK; } +int os2MutexEnd(void){ return SQLITE_OK; } /* ** The sqlite3_mutex_alloc() routine allocates a new @@ -84,7 +84,7 @@ int sqlite3_mutex_end(void){ return SQLITE_OK; } ** mutex types, the same mutex is returned on every call that has ** the same type number. */ -sqlite3_mutex *sqlite3_mutex_alloc(int iType){ +sqlite3_mutex *os2MutexAlloc(int iType){ sqlite3_mutex *p = NULL; switch( iType ){ case SQLITE_MUTEX_FAST: @@ -152,7 +152,7 @@ sqlite3_mutex *sqlite3_mutex_alloc(int iType){ ** This routine deallocates a previously allocated mutex. ** SQLite is careful to deallocate every mutex that it allocates. */ -void sqlite3_mutex_free(sqlite3_mutex *p){ +void os2MutexFree(sqlite3_mutex *p){ if( p==0 ) return; assert( p->nRef==0 ); assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ); @@ -171,7 +171,7 @@ void sqlite3_mutex_free(sqlite3_mutex *p){ ** can enter. If the same thread tries to enter any other kind of mutex ** more than once, the behavior is undefined. */ -void sqlite3_mutex_enter(sqlite3_mutex *p){ +void os2MutexEnter(sqlite3_mutex *p){ TID tid; PID holder1; ULONG holder2; @@ -182,7 +182,7 @@ void sqlite3_mutex_enter(sqlite3_mutex *p){ p->owner = tid; p->nRef++; } -int sqlite3_mutex_try(sqlite3_mutex *p){ +int os2MutexTry(sqlite3_mutex *p){ int rc; TID tid; PID holder1; @@ -207,7 +207,7 @@ int sqlite3_mutex_try(sqlite3_mutex *p){ ** is undefined if the mutex is not currently entered or ** is not currently allocated. SQLite will never do either. */ -void sqlite3_mutex_leave(sqlite3_mutex *p){ +void os2MutexLeave(sqlite3_mutex *p){ TID tid; PID holder1; ULONG holder2; @@ -224,7 +224,7 @@ void sqlite3_mutex_leave(sqlite3_mutex *p){ ** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are ** intended for use inside assert() statements. */ -int sqlite3_mutex_held(sqlite3_mutex *p){ +int os2MutexHeld(sqlite3_mutex *p){ TID tid; PID pid; ULONG ulCount; @@ -237,7 +237,7 @@ int sqlite3_mutex_held(sqlite3_mutex *p){ } return p==0 || (p->nRef!=0 && p->owner==tid); } -int sqlite3_mutex_notheld(sqlite3_mutex *p){ +int os2MutexNotheld(sqlite3_mutex *p){ TID tid; PID pid; ULONG ulCount; @@ -250,4 +250,21 @@ int sqlite3_mutex_notheld(sqlite3_mutex *p){ } return p==0 || p->nRef==0 || p->owner!=tid; } + +sqlite3_mutex_methods *sqlite3DefaultMutex(void){ + static sqlite3_mutex_methods sMutex = { + os2MutexInit, + os2MutexAlloc, + os2MutexFree, + os2MutexEnter, + os2MutexTry, + os2MutexLeave, + os2MutexEnd, + + os2MutexHeld, + os2MutexNotheld + }; + + return &sMutex; +} #endif /* SQLITE_MUTEX_OS2 */ diff --git a/src/os_os2.c b/src/os_os2.c index 827bb533fe..6025c11cd2 100644 --- a/src/os_os2.c +++ b/src/os_os2.c @@ -12,7 +12,7 @@ ** ** This file contains code that is specific to OS/2. ** -** $Id: os_os2.c,v 1.43 2008/06/13 18:24:27 drh Exp $ +** $Id: os_os2.c,v 1.44 2008/06/18 21:08:16 pweilbacher Exp $ */ #include "sqliteInt.h" @@ -695,13 +695,13 @@ static int os2Open( APIRET rc = NO_ERROR; ULONG ulAction; char *zNameCp; - char zTmpname[MAX_PATH+1]; /* Buffer to hold name of temp file */ + char zTmpname[CCHMAXPATH+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); + int rc = getTempname(CCHMAXPATH+1, zTmpname); if( rc!=SQLITE_OK ){ return rc; } @@ -1041,6 +1041,10 @@ int os2CurrentTime( sqlite3_vfs *pVfs, double *prNow ){ return 0; } +static int os2GetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ + return 0; +} + /* ** Return a pointer to the sqlite3DefaultVfs structure. We use ** a function rather than give the structure global scope because @@ -1066,7 +1070,7 @@ sqlite3_vfs *sqlite3OsDefaultVfs(void){ os2DlClose, /* xDlClose */ os2Randomness, /* xRandomness */ os2Sleep, /* xSleep */ - os2CurrentTime /* xCurrentTime */ + os2CurrentTime, /* xCurrentTime */ os2GetLastError /* xGetLastError */ };