Commit Graph

466 Commits

Author SHA1 Message Date
drh
ef595984ec Fix a harmless compiler warning introduced by the previous check-in.
FossilOrigin-Name: a8a042a751557d06bf04455ed7629cb29adcd87f
2012-02-13 20:28:15 +00:00
drh
8c815d14f8 On unix, ignore the umask when creating journal files. That way, journal files
will have exactly the same permissions as the original database and any
process that has permission to write to the database can also recover
hot journals.

FossilOrigin-Name: 84b324606adc8437338c086404eb157f30f04130
2012-02-13 20:16:37 +00:00
dan
d3eaebd414 Fix a typo in the type of the fchown() function in os_unix.c.
FossilOrigin-Name: bfbfe05b81919ecc3d6e7be4c24994f795f16582
2012-02-13 08:50:23 +00:00
drh
23c4b97329 Make fchown() an overrideable system call in os_unix.c.
FossilOrigin-Name: 98efac9630ca96ba0497c8e206dc5022612ff381
2012-02-11 23:55:15 +00:00
drh
3ee3484c4a Silence GCC compiler warnings about unused return value from fchown().
FossilOrigin-Name: b022547389a40930cf0d2a75f5eb293acc9fbfe0
2012-02-11 21:21:17 +00:00
drh
ac7c3ac150 When creating journal files (including -wal and -shm files) try to set the
ownership to be the same as the original database.  This will prevent root
from locking out the original owner of the file.

FossilOrigin-Name: 1254dffe4071656a783cd000b1dd40c975ac18cb
2012-02-11 19:23:48 +00:00
drh
c96d1e79a8 Remove a redundant test from the shared-memory logic in os_unix.c.
FossilOrigin-Name: 31142ca795005bf664f34000591e6572c72652f2
2012-02-11 18:51:34 +00:00
drh
c18b40462b Fix an important bug in the handling of EINTR in unixRead(). Never came
up on x86 but crashes on sparc.

FossilOrigin-Name: 1a16db0bca717a2582a48332d81854ca90d6d49b
2012-02-10 03:10:27 +00:00
drh
c02a43afae Only require double-zero terminators on database filenames, not any every
files supplied to the xOpen method.  This backs out [2544f233f1].  Also
refactor the fillInUnixFile() routine in os_unix.c to reduce the number
of parameters.

FossilOrigin-Name: cb774b26e13745cfad0d76a71e47466d703e0007
2012-01-10 23:18:38 +00:00
drh
9cb5a0d989 Make sure the name of the shared memory file has two zero-terminators in the
UNIX VFS, so that sqlite3_uri_parameter() will work correctly on that name.

FossilOrigin-Name: 3d088ba5e36c0b6bccc86986f8fa9a22b340c297
2012-01-05 21:19:54 +00:00
drh
e349519f1e Change the unix VFS so that it ignores all but the least-significant bit
of the syncDir flag to xDelete.  Add an assert to prove that the core only
ever uses that one bit.

FossilOrigin-Name: e75fd3b27423272b988921ac0e272f9600818b8c
2012-01-05 16:07:30 +00:00
drh
bce51350d6 Remove the SQLITE_FCNTL_SYNC_OMITTED cases from the unix and windows VFSes
as they are no longer needed because of check-in [fd3822f1f2].

FossilOrigin-Name: 7cf568a101cda20ab6005bd250154b7f6960193a
2012-01-05 11:43:10 +00:00
drh
52bcde0e2d Make sure filenames passed into sqlite3OsOpen() always have the extra
zero-terminators needed by sqlite3_uri_parameter().

FossilOrigin-Name: d73e93cfdc9441ade77b796dcdcf6eeb753cb398
2012-01-03 14:50:45 +00:00
drh
8942d4125e Remove the code that attempts to find the sector size from the OS and
hardcode the xSectorSize methods of the unix and windows VFSes to return
SQLITE_DEFAULT_SECTOR_SIZE, which is now set to 4096 unless overridden.

FossilOrigin-Name: 03d8362cd2cadab8e1cc5b18a3194152f2bd0a84
2012-01-02 18:20:14 +00:00
drh
cb15f35f3b Change the name ZERO_DAMAGE to the more descriptive POWERSAFE_OVERWRITE.
The query parameter used to control this device characteristic is now "psow".

FossilOrigin-Name: 6191c5e45175f5c6040e891843b0725a929d6dd7
2011-12-23 01:04:17 +00:00
drh
bec7c97899 Merge the latest trunk changes into the statvfs branch.
FossilOrigin-Name: d5e36327c12f264429eb079bddbb71a310f76389
2011-12-23 00:25:02 +00:00
drh
9291372094 Add interfaces sqlite3_uri_boolean() and sqlite3_uri_int64() which are
wrappers around sqlite3_uri_parameter() combined with internal routines for
converting strings to booleans and 64-bit integers.

FossilOrigin-Name: 83d26b9a9115eadac9e59a33d608bca0ab2519e3
2011-12-23 00:07:33 +00:00
drh
f12b3f609f Add the ability to enable or disable SQLITE_IOCAP_ZERO_DAMAGE using a URI
parameter for both unix and windows.  Add a file-control to query or disable
the ZERO_DAMAGE setting.  Add the -uri option to the "sqlite3" TCL command
in tclsqlite3.c.  Allow the sqlite3_uri_parameter() interface to accept a
NULL pointer for its first parameter.

FossilOrigin-Name: c83627b73285f883719845c1b9fe85f378f28dd2
2011-12-21 14:42:29 +00:00
drh
8bbaa89d8d Add SQLITE_IOCAP_ZERO_DAMAGE and enable it for both unix and windows. Use
this device characteristic to reduce the required work in journaling.
A side effect is that this changes the default page exists back to 1024
even with the use of statvfs().

FossilOrigin-Name: a0be6ea464695fdf1eaf2b7cf0652778617814f2
2011-12-17 19:49:02 +00:00
drh
9c0e29371e Fix a bad #endif with the previous check-in on this branch.
FossilOrigin-Name: 915713ffe4d02ddf1d09a82e39a47b88d3d95ea0
2011-12-17 16:25:17 +00:00
drh
1da88f025f Add support for statvfs() in os_unix.c, for determining the sector size.
This causes many TCL test failures under Linux.

FossilOrigin-Name: e0d44450b9bec8ea7b057c1ad0a2088cd3f1f221
2011-12-17 16:09:16 +00:00
drh
a60ef3d570 Merge the nx-devkit changes into trunk. This includes the new
SQLITE_FCNTL_VFSNAME file-control.

FossilOrigin-Name: da118e02c0576ce16f7a26663f59413316223d55
2011-12-14 18:33:13 +00:00
drh
de60fc2d87 Add a file-control that will discover the name of the bottom-level VFS and
all the shims in between.

FossilOrigin-Name: cdbfb553af02d10767a905489d9dfc57fc6be54e
2011-12-14 17:53:36 +00:00
drh
73795becfe Backport a minimal set of changes needed to get 8+3 filenames and the
multiplexor shim playing well together.

FossilOrigin-Name: c4e2ce486217c96373836bfe641f46abf891799a
2011-12-12 20:01:12 +00:00
dan
28a67fd3f8 Fix os_unix.c so that, unless 8.3 filenames are actually in use, journal and wal file permissions are assigned correctly even if SQLITE_ENABLE_8_3_NAMES is defined.
FossilOrigin-Name: 169e12295cca701443746b1209bd6a7714fd8988
2011-12-12 19:48:43 +00:00
drh
13e0ea9923 Fix harmless compiler warnings.
FossilOrigin-Name: 1e6a698aab9270637d3ea00fd6b0e94f4172e875
2011-12-11 02:29:25 +00:00
drh
5802464316 Make the unix VFS tolerant of read() calls that return less than the
requested number of bytes.

FossilOrigin-Name: a210695abcfa5cb04279edfd04824d881b7c4ada
2011-11-07 18:16:00 +00:00
drh
9ef6bc427a Use mkdir() and rmdir() rather than open() and unlink() to create the lock
files with the unix-dotlock VFS.  The change is backwards compatible and,
we are told, works better on some network filesystems.

FossilOrigin-Name: e2f08426d7a84a2ac6148f485b7af377201a175b
2011-11-04 02:24:02 +00:00
drh
d337c5bde8 Fix an issue with finding the access permissions of journal files when
8+3 filenames are in use.

FossilOrigin-Name: 2b35c5144ddcc2ed6d0fcaa8c0ba5d20b9487be7
2011-10-20 18:23:35 +00:00
drh
30ddce6ff4 Added the tool/warnings-clang.sh script. Changes so that there are no
warnings with either gcc or clang even including FTS4 and RTREE and
both with and without SQLITE_THREADSAFE=0.

FossilOrigin-Name: 39408702a989f907261c298bf0947f3e68bd10fe
2011-10-15 00:16:30 +00:00
drh
b07028f71c Add assert() statements and eliminate needless variable assignments in order
to get the clang scan-build utility to report zero problems against the
SQLite core.  Clang's static analysis did find one real problem - but it was
in the command-line shell, not in the SQLite core.

FossilOrigin-Name: 60fee9574b0125705787e33c16f116cf188c8323
2011-10-14 21:49:18 +00:00
drh
b87a666315 Fix a harmless compiler warning introduced into os_unix.c by one of the
recent changes.

FossilOrigin-Name: 4bf4d5ebfbf5d157a8bf3a3817e2ce350f25af0e
2011-10-13 01:01:14 +00:00
drh
3170225f19 The date/time functions return NULL if the xCurrentTime or
xCurrentTimeInt64 VFS methods fail.
Ticket [0b803bff856c644c]

FossilOrigin-Name: c96651dd6ceadd51c9e1f4d942177d3c128c47b4
2011-10-12 23:13:43 +00:00
drh
3ec4a0c1a5 Change the behavior of the readonly_shm=1 query parameter so that it never
attempts to open the -shm file read/write.

FossilOrigin-Name: f1364004836078378e4005ab3eb9c0a04e3d4ce7
2011-10-11 18:18:54 +00:00
drh
c47167a6a8 When finding the appropriate file permissions for journal files with
SQLITE_ENABLE_8_3_NAMES, ignore "-" characters in the name of the
containing directory.

FossilOrigin-Name: 328cc1867ffbbf1c953dfd843649f5f209c8e6ec
2011-10-05 15:26:13 +00:00
drh
20f8e13b44 Formerly, we enabled fdatasync() on linux only. But now we learn that
fdatasync() is not supported on Android.  So we disable fdatasync() on
Linux too.  It can be reenabled at compile-time for those who really need it.

FossilOrigin-Name: 70b5b309568ac55565558d5456aca1e431cfd26b
2011-08-31 21:01:55 +00:00
drh
fd53231c85 Always include the unixShm.id field, even when not debugging.
FossilOrigin-Name: 07803476206b8cde60ccc320b9ccdc0d48a41d65
2011-08-31 18:35:34 +00:00
mistachkin
d589a5444b Make sure SQLITE_FCNTL_SIZE_HINT a no-op if the chunk size is not greater than zero.
FossilOrigin-Name: 88b763e8d73fafa1538b08af28b1c8b723b39c61
2011-08-30 01:23:34 +00:00
drh
2f7820d8b5 Back out [05c9832e5f6eb] since it was causing a performance regression with
no obvious benefit.

FossilOrigin-Name: 639cc85a911454bffdcccb33f2976c683953ae64
2011-08-29 11:56:14 +00:00
drh
3d4435b234 Fix several harmless compiler warnings and a documentation bug.
FossilOrigin-Name: 5454d0fe227b7c1f0e7715b6c08f97019628fc4c
2011-08-26 20:55:50 +00:00
dan
ee140c4d71 Fix the SQLITE_DISABLE_DIRSYNC compile time option.
FossilOrigin-Name: 6deb3ea1f080324ea23ebdc9008753fbbc4063e2
2011-08-25 13:46:32 +00:00
drh
1ee6f74046 If the application-defined openDirectory() function returns SQLITE_CANTOPEN,
then silently ignore the error.  This allows the chromium sandbox to disallow
opening of directories without causing errors.

FossilOrigin-Name: 880b51150aaed804005f5062b4dd2fa0ffafa147
2011-08-23 20:11:32 +00:00
dan
da04ea4f88 Change to test instrumentation of os_unix.c: Regard IO errors that occur within SQLITE_FCNTL_SIZE_HINT requests as benign.
FossilOrigin-Name: ca47da2a1f6e6d221470e7f02b129fc21c288d7b
2011-08-23 05:10:39 +00:00
drh
bd1e50c920 When retrying a write() after an EINTR error on unix, be sure to also
rerun the previous lseek().  Ticket [e59bdf6116036a]

FossilOrigin-Name: 21452f3ae6b5882b03c7cc41e661c7b8144cc3df
2011-08-19 14:54:12 +00:00
drh
90315a2417 Make the openDirectory routine in os_unix.c overrideable so that it can
be turned into a harmless no-op for the chromium sandbox.

FossilOrigin-Name: 6b236069e1ea3c99ff0a007a790d4baebda70b13
2011-08-10 01:52:12 +00:00
drh
0059eae367 In os_unix.c, do not open the directory containing the database file when
the database file is opened.  Instead, wait until time to fsync() the
directory.  And do not report an error if the open fails, since some
systems (Ex: AIX and a chromium sandbox) are unable to open and fsync
directories.

FossilOrigin-Name: 713b1b7dc1296e9cee42aeaad8c85528155f721d
2011-08-08 23:48:40 +00:00
drh
036ac7fa90 Allow the unlink() system call to be overridden in os_unix.c.
FossilOrigin-Name: 8d1b5c3ac027ac00d57a250aad45230a09645617
2011-08-08 23:18:05 +00:00
mistachkin
5b7f786e7e Merge changes for the new sqlite3_file_control() that will cause the -wal and -shm files to persist after the last database connection closes.
FossilOrigin-Name: 1b56677bdfb102d070a2057a65ba424fec81131d
2011-07-28 20:48:38 +00:00
drh
58384f1720 Use osStat() instead of stat() consistently in os_unix.c
FossilOrigin-Name: 9109128cb5640d687251dfbefa2fd998063cd9fb
2011-07-28 00:14:45 +00:00
drh
253cea5c6f Test cases added. Fix the query mode.
FossilOrigin-Name: a9d8794ae949df570466a84836882bc8bed95c7c
2011-07-26 16:23:25 +00:00