]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use a separate mutex (SQLITE_MUTEX_STATIC_VFS2) for the VxWorks file list vxworks
authordrh <>
Wed, 10 Sep 2025 18:34:09 +0000 (18:34 +0000)
committerdrh <>
Wed, 10 Sep 2025 18:34:09 +0000 (18:34 +0000)
in os_unix.c.

FossilOrigin-Name: 8f45f1a9d9208fbf124c4087092718b83cd653126bc1ed5f388e3577561f615b

manifest
manifest.uuid
src/os_unix.c

index e572aaba4b193434c3757bbd025d81743bf226a5..5868aa10c61fd026c204d657f895d7f4607f4ae3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C If\sopen\sfiles\sin\sVxWorks,\sdo\snot\sunlink\sthe\sfile\sunless\sthe\sfile\swas\smarked\nas\sdelete-on-close.
-D 2025-09-09T19:00:55.004
+C Use\sa\sseparate\smutex\s(SQLITE_MUTEX_STATIC_VFS2)\sfor\sthe\sVxWorks\sfile\slist\nin\sos_unix.c.
+D 2025-09-10T18:34:09.319
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -726,7 +726,7 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
 F src/os_kv.c 4d39e1f1c180b11162c6dc4aa8ad34053873a639bac6baae23272fc03349986a
 F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d872107
-F src/os_unix.c 7210cc026cbe8a5da0258dc9eb005cf24074ad770ab368bff7e70dc3db4ed75a
+F src/os_unix.c b3da55bc4bb214b2bfb1e430b10e9d3ebcf6b11741921ab044c9b9539c8fcc4f
 F src/os_win.c f81a7cffdfe8c593a840895b3f64290714f0186b06302d2c397012252d830374
 F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
 F src/pager.c ee48e0cc9ae4abfd7c37b838bff62a14d520a9fa311007fa57929ac7cc5d609c
@@ -2174,8 +2174,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 4720205249214c01f6e63738e4927c0f53c853346cc2dfa45522aaa469f4d702
-R 28cd361ab09796e13d6919ca761a942b
+P bb6114dbbf3bfbea57cd9be21666299663e94576b0175f6aeefd1d0f7107398e
+R 014427910e7a9ddec7a51b8b4173351b
 U drh
-Z 60929786cacc94424cefe1a0e89c6c19
+Z c33f9a334f3b1502222626b4f7b7e337
 # Remove this line to create a well-formed Fossil manifest.
index 2676409b7450ecd53a5f0eca238ab99dfaffef0b..f5472726acc23e4a270e5a44f80bb348b7c44e29 100644 (file)
@@ -1 +1 @@
-bb6114dbbf3bfbea57cd9be21666299663e94576b0175f6aeefd1d0f7107398e
+8f45f1a9d9208fbf124c4087092718b83cd653126bc1ed5f388e3577561f615b
index c5489f0023fe4ea0e1d492fbb4030e2150c98bc8..b9e10b2c81cd9f4ae12f26b35ef921b3e680be97 100644 (file)
@@ -760,9 +760,8 @@ static int robust_open(const char *z, int f, mode_t m){
 
 /*
 ** Helper functions to obtain and relinquish the global mutex. The
-** global mutex is used to protect the unixInodeInfo and
-** vxworksFileId objects used by this file, all of which may be
-** shared by multiple threads.
+** global mutex is used to protect the unixInodeInfo objects used by
+** this file, all of which may be shared by multiple threads.
 **
 ** Function unixMutexHeld() is used to assert() that the global mutex
 ** is held when required. This function is only used as part of assert()
@@ -964,6 +963,7 @@ struct vxworksFileId {
 ** variable:
 */
 static struct vxworksFileId *vxworksFileList = 0;
+static sqlite3_mutex *vxworksMutex = 0;
 
 /*
 ** Simplify a filename into its canonical form
@@ -1029,14 +1029,14 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
   ** If found, increment the reference count and return a pointer to
   ** the existing file ID.
   */
-  unixEnterMutex();
+  sqlite3_mutex_enter(vxworksMutex);
   for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){
     if( pCandidate->nName==n
      && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0
     ){
        sqlite3_free(pNew);
        pCandidate->nRef++;
-       unixLeaveMutex();
+       sqlite3_mutex_leave(vxworksMutex);
        return pCandidate;
     }
   }
@@ -1046,7 +1046,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
   pNew->nName = n;
   pNew->pNext = vxworksFileList;
   vxworksFileList = pNew;
-  unixLeaveMutex();
+  sqlite3_mutex_leave(vxworksMutex);
   return pNew;
 }
 
@@ -1055,7 +1055,7 @@ static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){
 ** the object when the reference count reaches zero.
 */
 static void vxworksReleaseFileId(struct vxworksFileId *pId){
-  unixEnterMutex();
+  sqlite3_mutex_enter(vxworksMutex);
   assert( pId->nRef>0 );
   pId->nRef--;
   if( pId->nRef==0 ){
@@ -1065,7 +1065,7 @@ static void vxworksReleaseFileId(struct vxworksFileId *pId){
     *pp = pId->pNext;
     sqlite3_free(pId);
   }
-  unixLeaveMutex();
+  sqlite3_mutex_leave(vxworksMutex);
 }
 #endif /* OS_VXWORKS */
 /*************** End of Unique File ID Utility Used By VxWorks ****************
@@ -8292,6 +8292,9 @@ int sqlite3_os_init(void){
   sqlite3KvvfsInit();
 #endif
   unixBigLock = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS1);
+#if OS_VXWORKS
+  vxworksMutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_VFS2);
+#endif
 
 #ifndef SQLITE_OMIT_WAL
   /* Validate lock assumptions */
@@ -8326,6 +8329,9 @@ int sqlite3_os_init(void){
 */
 int sqlite3_os_end(void){
   unixBigLock = 0;
+#if OS_VXWORKS
+  vxworksMutex = 0;
+#endif
   return SQLITE_OK;
 }