Sd card mount/unmount
(1) By ayagmur75 on 2020-06-04 09:17:51 [link] [source]
Hello, We have been using a device which has linux operating system. We have been keeping sqlite database file in a sd-card. In normal conditions, after mounting/unmouting we use sqlite database without problem. But sometimes, randomly, we can encounter with an unmount problem: "resource or device busy".
As far as I know, sqlite can cause some problems with network-mounted file systems. I wonder if sd-card mounted file system cause also this kind of error?
Can you please help me?
Thank you very much
(2) By ayagmur75 on 2020-06-04 10:47:18 in reply to 1 [source]
I forgot to add some code. Problem occurs in this sequence; ... sqlite3_close(db); umount('sd-card'); ... Best regards,
(3) By anonymous on 2020-06-07 12:51:14 in reply to 2 [link] [source]
You should check the return value of this call. If the returned value is not
SQLITE_OK, the database isn't actually closed, and you have leaks of some other resources depending on
db (e.g. prepared statements). See https://sqlite.org/c3ref/close.html for more information on that.
If you do get
sqlite3_close, consider using
fuser to find out if there are any open filehandles on that filesystem. (On an embedded device, where you cannot use
fuser because they don't fit in the image, you can iterate over
/proc/*/fd. But this is an embedded Linux question, not an SQLite question.)