/ Check-in [ed715b47]
Login

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

Overview
Comment:Add the xShmRelease() method to the VFS. The os_unix.c implementation of the shared memory logic is still non-functional.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wal
Files: files | file ages | folders
SHA1: ed715b47c5f7657fbf901805981867898054b14d
User & Date: drh 2010-04-27 11:49:27
Context
2010-04-27
18:49
Merge two "wal" leaves. check-in: 8c2d43ba user: dan tags: wal
11:49
Add the xShmRelease() method to the VFS. The os_unix.c implementation of the shared memory logic is still non-functional. check-in: ed715b47 user: drh tags: wal
06:49
Run trans.test and avtrans.test as part of the "wal" permutation. check-in: c8893310 user: dan tags: wal
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_os2.c.

  1107   1107       os2DlOpen,         /* xDlOpen */
  1108   1108       os2DlError,        /* xDlError */
  1109   1109       os2DlSym,          /* xDlSym */
  1110   1110       os2DlClose,        /* xDlClose */
  1111   1111       os2Randomness,     /* xRandomness */
  1112   1112       os2Sleep,          /* xSleep */
  1113   1113       os2CurrentTime,    /* xCurrentTime */
  1114         -    os2GetLastError    /* xGetLastError */
  1115         -    0,                 /* xShmOpen */
  1116         -    0,                 /* xShmSize */
  1117         -    0,                 /* xShmPush */
  1118         -    0,                 /* xShmPull */
  1119         -    0,                 /* xShmLock */
  1120         -    0,                 /* xShmClose */
  1121         -    0,                 /* xShmDelete */
  1122         -    0,                 /* xRename */
  1123         -    0,                 /* xCurrentTimeInt64 */
         1114  +    os2GetLastError,   /* xGetLastError */
  1124   1115     };
  1125   1116     sqlite3_vfs_register(&os2Vfs, 1);
  1126   1117     initUconvObjects();
  1127   1118     return SQLITE_OK;
  1128   1119   }
  1129   1120   int sqlite3_os_end(void){
  1130   1121     freeUconvObjects();
  1131   1122     return SQLITE_OK;
  1132   1123   }
  1133   1124   
  1134   1125   #endif /* SQLITE_OS_OS2 */

Changes to src/os_unix.c.

  4643   4643     return rc;
  4644   4644   }
  4645   4645   
  4646   4646   /*
  4647   4647   ** Query and/or changes the size of a shared-memory segment.
  4648   4648   ** The reqSize parameter is the new size of the segment, or -1 to
  4649   4649   ** do just a query.  The size of the segment after resizing is
  4650         -** written into pNewSize.  The start of the shared memory buffer
  4651         -** is stored in **ppBuffer.
         4650  +** written into pNewSize.  A writer lock is held on the shared memory
         4651  +** segment while resizing it.
         4652  +**
         4653  +** If ppBuffer is not NULL, the a reader lock is acquired no the shared
         4654  +** memory segment and *ppBuffer is made to point to the start of the 
         4655  +** shared memory segment.  xShmRelease() must be called to release the
         4656  +** lock.
  4652   4657   */
  4653   4658   static int unixShmSize(
  4654   4659     sqlite3_shm *pSharedMem,  /* Pointer returned by unixShmOpen() */
  4655   4660     int reqSize,              /* Requested size.  -1 for query only */
  4656   4661     int *pNewSize,            /* Write new size here */
  4657   4662     char **ppBuf              /* Write new buffer origin here */
  4658   4663   ){
................................................................................
  4674   4679         }
  4675   4680       }
  4676   4681     }
  4677   4682     *pNewSize = p->size;
  4678   4683     *ppBuf = p->pBuf;
  4679   4684     return rc;
  4680   4685   }
         4686  +
         4687  +/*
         4688  +** Release the lock held on the shared memory segment to that other
         4689  +** threads are free to resize it if necessary.
         4690  +*/
         4691  +static int unixShmRelease(sqlite3_shm *pSharedMem){
         4692  +  return SQLITE_OK;
         4693  +}
  4681   4694   
  4682   4695   /*
  4683   4696   ** Create or release a lock on shared memory.
  4684   4697   */
  4685   4698   static int unixShmLock(
  4686   4699     sqlite3_shm *pSharedMem,   /* Pointer from unixShmOpen() */
  4687   4700     int lockType,              /* _RDLK, _WRLK, or _UNLK, possibly ORed _BLOCK */
................................................................................
  5930   5943       unixDlClose,          /* xDlClose */                    \
  5931   5944       unixRandomness,       /* xRandomness */                 \
  5932   5945       unixSleep,            /* xSleep */                      \
  5933   5946       unixCurrentTime,      /* xCurrentTime */                \
  5934   5947       unixGetLastError,     /* xGetLastError */               \
  5935   5948       unixShmOpen,          /* xShmOpen */                    \
  5936   5949       unixShmSize,          /* xShmSize */                    \
         5950  +    unixShmRelease,       /* xShmRelease */                 \
  5937   5951       0,                    /* xShmPush */                    \
  5938   5952       0,                    /* xShmPull */                    \
  5939   5953       unixShmLock,          /* xShmLock */                    \
  5940   5954       unixShmClose,         /* xShmClose */                   \
  5941   5955       unixShmDelete,        /* xShmDelete */                  \
  5942   5956       0,                    /* xRename */                     \
  5943   5957       0,                    /* xCurrentTimeInt64 */           \

Changes to src/os_win.c.

  1908   1908       winDlOpen,         /* xDlOpen */
  1909   1909       winDlError,        /* xDlError */
  1910   1910       winDlSym,          /* xDlSym */
  1911   1911       winDlClose,        /* xDlClose */
  1912   1912       winRandomness,     /* xRandomness */
  1913   1913       winSleep,          /* xSleep */
  1914   1914       winCurrentTime,    /* xCurrentTime */
  1915         -    winGetLastError    /* xGetLastError */
  1916         -    0,                 /* xShmOpen */
  1917         -    0,                 /* xShmSize */
  1918         -    0,                 /* xShmPush */
  1919         -    0,                 /* xShmPull */
  1920         -    0,                 /* xShmLock */
  1921         -    0,                 /* xShmClose */
  1922         -    0,                 /* xShmDelete */
  1923         -    0,                 /* xRename */
  1924         -    0,                 /* xCurrentTimeInt64 */
         1915  +    winGetLastError,   /* xGetLastError */
  1925   1916     };
  1926   1917   
  1927   1918     sqlite3_vfs_register(&winVfs, 1);
  1928   1919     return SQLITE_OK; 
  1929   1920   }
  1930   1921   int sqlite3_os_end(void){ 
  1931   1922     return SQLITE_OK;
  1932   1923   }
  1933   1924   
  1934   1925   #endif /* SQLITE_OS_WIN */

Changes to src/sqlite.h.in.

   840    840     int (*xCurrentTime)(sqlite3_vfs*, double*);
   841    841     int (*xGetLastError)(sqlite3_vfs*, int, char *);
   842    842     /*
   843    843     ** The methods above are in version 1 of the sqlite_vfs object
   844    844     ** definition.  Those that follow are added in version 2 or later
   845    845     */
   846    846     int (*xShmOpen)(sqlite3_vfs*, const char *zName, sqlite3_shm**);
   847         -  int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize, char **);
          847  +  int (*xShmSize)(sqlite3_shm*, int reqSize, int *pNewSize, char**);
          848  +  int (*xShmRelease)(sqlite3_shm*);
   848    849     int (*xShmPush)(sqlite3_shm*);
   849    850     int (*xShmPull)(sqlite3_shm*);
   850    851     int (*xShmLock)(sqlite3_shm*, int lockType, int ofst, int nByte);
   851    852     int (*xShmClose)(sqlite3_shm*);
   852    853     int (*xShmDelete)(sqlite3_vfs*, const char *zName);
   853    854     int (*xRename)(sqlite3_vfs*, const char *zOld, const char *zNew, int dirSync);
   854    855     int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);

Changes to src/test6.c.

   778    778       cfDlOpen,             /* xDlOpen */
   779    779       cfDlError,            /* xDlError */
   780    780       cfDlSym,              /* xDlSym */
   781    781       cfDlClose,            /* xDlClose */
   782    782       cfRandomness,         /* xRandomness */
   783    783       cfSleep,              /* xSleep */
   784    784       cfCurrentTime,        /* xCurrentTime */
   785         -    0,                    /* xShmOpen */
   786         -    0,                    /* xShmSize */
   787         -    0,                    /* xShmPush */
   788         -    0,                    /* xShmPull */
   789         -    0,                    /* xShmLock */
   790         -    0,                    /* xShmClose */
   791         -    0,                    /* xShmDelete */
   792         -    0,                    /* xRename */
   793         -    0                     /* xCurrentTimeInt64 */
   794    785     };
   795    786   
   796    787     if( objc!=2 ){
   797    788       Tcl_WrongNumArgs(interp, 1, objv, "ENABLE");
   798    789       return TCL_ERROR;
   799    790     }
   800    791   

Changes to src/test_demovfs.c.

   620    620       demoDlOpen,                   /* xDlOpen */
   621    621       demoDlError,                  /* xDlError */
   622    622       demoDlSym,                    /* xDlSym */
   623    623       demoDlClose,                  /* xDlClose */
   624    624       demoRandomness,               /* xRandomness */
   625    625       demoSleep,                    /* xSleep */
   626    626       demoCurrentTime,              /* xCurrentTime */
   627         -    0,                            /* xShmOpen */
   628         -    0,                            /* xShmSize */
   629         -    0,                            /* xShmPush */
   630         -    0,                            /* xShmPull */
   631         -    0,                            /* xShmLock */
   632         -    0,                            /* xShmClose */
   633         -    0,                            /* xShmDelete */
   634         -    0,                            /* xRename */
   635         -    0                             /* xCurrentTimeInt64 */
   636    627     };
   637    628     return &demovfs;
   638    629   }
   639    630   
   640    631   #endif /* !defined(SQLITE_TEST) || defined(SQLITE_OS_UNIX) */
   641    632   
   642    633   

Changes to src/test_devsym.c.

    89     89     0,                        /* xDlError */
    90     90     0,                        /* xDlSym */
    91     91     0,                        /* xDlClose */
    92     92   #endif /* SQLITE_OMIT_LOAD_EXTENSION */
    93     93     devsymRandomness,         /* xRandomness */
    94     94     devsymSleep,              /* xSleep */
    95     95     devsymCurrentTime,        /* xCurrentTime */
    96         -  0,                        /* xShmOpen */
    97         -  0,                        /* xShmSize */
    98         -  0,                        /* xShmPush */
    99         -  0,                        /* xShmPull */
   100         -  0,                        /* xShmLock */
   101         -  0,                        /* xShmClose */
   102         -  0,                        /* xShmDelete */
   103         -  0,                        /* xRename */
   104         -  0                         /* xCurrentTimeInt64 */
   105     96   };
   106     97   
   107     98   static sqlite3_io_methods devsym_io_methods = {
   108     99     1,                            /* iVersion */
   109    100     devsymClose,                      /* xClose */
   110    101     devsymRead,                       /* xRead */
   111    102     devsymWrite,                      /* xWrite */

Changes to src/test_journal.c.

   176    176     jtDlOpen,                      /* xDlOpen */
   177    177     jtDlError,                     /* xDlError */
   178    178     jtDlSym,                       /* xDlSym */
   179    179     jtDlClose,                     /* xDlClose */
   180    180     jtRandomness,                  /* xRandomness */
   181    181     jtSleep,                       /* xSleep */
   182    182     jtCurrentTime,                 /* xCurrentTime */
   183         -  0,                             /* xShmOpen */
   184         -  0,                             /* xShmSize */
   185         -  0,                             /* xShmPush */
   186         -  0,                             /* xShmPull */
   187         -  0,                             /* xShmLock */
   188         -  0,                             /* xShmClose */
   189         -  0,                             /* xShmDelete */
   190         -  0,                             /* xRename */
   191         -  0                              /* xCurrentTimeInt64 */
   192    183   };
   193    184   
   194    185   static sqlite3_io_methods jt_io_methods = {
   195    186     1,                             /* iVersion */
   196    187     jtClose,                       /* xClose */
   197    188     jtRead,                        /* xRead */
   198    189     jtWrite,                       /* xWrite */

Changes to src/test_osinst.c.

   200    200     instDlOpen,             /* xDlOpen */
   201    201     instDlError,            /* xDlError */
   202    202     instDlSym,              /* xDlSym */
   203    203     instDlClose,            /* xDlClose */
   204    204     instRandomness,         /* xRandomness */
   205    205     instSleep,              /* xSleep */
   206    206     instCurrentTime,        /* xCurrentTime */
   207         -  0,                      /* xShmOpen */
   208         -  0,                      /* xShmSize */
   209         -  0,                      /* xShmPush */
   210         -  0,                      /* xShmPull */
   211         -  0,                      /* xShmLock */
   212         -  0,                      /* xShmClose */
   213         -  0,                      /* xShmDelete */
   214         -  0,                      /* xRename */
   215         -  0                       /* xCurrentTimeInt64 */
   216    207   };
   217    208   
   218    209   static sqlite3_io_methods inst_io_methods = {
   219    210     1,                            /* iVersion */
   220    211     instClose,                      /* xClose */
   221    212     instRead,                       /* xRead */
   222    213     instWrite,                      /* xWrite */