2011/2/28 Richard Hipp <d...@sqlite.org> > On Mon, Feb 28, 2011 at 7:39 AM, Paweł Hajdan, Jr. < > phajdan...@chromium.org> wrote: > >> I'd like to add an equivalent of fdopen to the sqlite's VFS ( >> http://www.sqlite.org/c3ref/vfs.html). The signature would similar to >> this: >> >> int (*xFdOpen)(sqlite3_vfs*, int fd, sqlite3_file*, int flags, int >> *pOutFlags); >> > > What does xFdOpen() do in your proposal? Who calls xFdOpen()? What does > xFdOpen() return? What processing does xFdOpen() perform? >
I think I'd need your help to make this more precise/complete, but here's what I have: I'd need a corresponding sqlite3_fdopen call, that would be similar to sqlite3_open but take a file descriptor instead of a path, and then use xFdOpen to actually perform the operation. xFdOpen would return an error code I guess (I intend to make its behavior almost identical to xOpen, with the only difference being using fd instead of a path). Internally xFdOpen would do everything that xOpen would do after getting a file descriptor. The context where I'd like to use sqlite3_fdopen is http://codesearch.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp&l=72&exact_package=chromium . PlatformBridge::databaseOpenFile returns a file descriptor (received from the browser process, and transferred over a local socket to the sandboxed renderer process; the linked code runs inside the renderer; it can't call open directly). I remember a part of earlier discussion that there is a problem with journal and possibly other auxiliary files, i.e. we can't create/open them just based on one file descriptor. There is a possibility that I'm not seeing/posting all relevant parts of the code, or that it's just broken. I'd need your advice on the above, i.e. assuming that the code can't call open directly (the call will fail because of the sandbox) but it can ask the browser process to open a file and send back a file descriptor. It is possible that instead of this entire xFdOpen thing that I suggested, it would be better to make it possible to pass a custom function used by sqlite instead of POSIX's open. In this case, that would roughly be PlatformBridge::databaseOpenFile. Paweł Hajdan, Jr. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users