gnu: sqlite: Add locking-mode fix for the Hurd.
[jackhill/guix/guix.git] / gnu / packages / patches / sqlite-hurd.patch
1 Adapted from Debian: https://sources.debian.org/patches/sqlite3/3.32.3-1/20-hurd-locking-style.patch
2 Upstream status: Not upstreamed.
3
4 This patch is needed to get offloading to work.
5
6 Sqlite can use simple file locking mode, but that does not work for the Hurd;
7 a second sqlite process fails with a "locking protocol" error.
8
9 See also: https://bugs.debian.org/529734.
10
11 diff -purN sqlite-autoconf-3310100/sqlite3.c sqlite-autoconf-3310100-/sqlite3.c
12 --- sqlite-autoconf-3310100/sqlite3.c 2020-01-27 21:25:19.000000000 +0100
13 +++ sqlite-autoconf-3310100-/sqlite3.c 2020-07-01 11:50:13.768333806 +0200
14 @@ -33189,7 +33189,7 @@ SQLITE_PRIVATE const char *sqlite3Opcode
15 # include <sys/mman.h>
16 #endif
17
18 -#if SQLITE_ENABLE_LOCKING_STYLE
19 +#if SQLITE_ENABLE_LOCKING_STYLE || defined(__GNU__)
20 /* # include <sys/ioctl.h> */
21 # include <sys/file.h>
22 # include <sys/param.h>
23 @@ -35676,7 +35676,7 @@ static int dotlockClose(sqlite3_file *id
24 **
25 ** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off
26 */
27 -#if SQLITE_ENABLE_LOCKING_STYLE
28 +#if SQLITE_ENABLE_LOCKING_STYLE || defined(__GNU__)
29
30 /*
31 ** Retry flock() calls that fail with EINTR
32 @@ -38586,7 +38586,7 @@ IOMETHODS(
33 0 /* xShmMap method */
34 )
35
36 -#if SQLITE_ENABLE_LOCKING_STYLE
37 +#if SQLITE_ENABLE_LOCKING_STYLE || defined(__GNU__)
38 IOMETHODS(
39 flockIoFinder, /* Finder function name */
40 flockIoMethods, /* sqlite3_io_methods object name */
41 @@ -41142,6 +41142,8 @@ SQLITE_API int sqlite3_os_init(void){
42 UNIXVFS("unix", autolockIoFinder ),
43 #elif OS_VXWORKS
44 UNIXVFS("unix", vxworksIoFinder ),
45 +#elif defined(__GNU__)
46 + UNIXVFS("unix", flockIoFinder ),
47 #else
48 UNIXVFS("unix", posixIoFinder ),
49 #endif
50 @@ -41151,7 +41153,7 @@ SQLITE_API int sqlite3_os_init(void){
51 #if OS_VXWORKS
52 UNIXVFS("unix-namedsem", semIoFinder ),
53 #endif
54 -#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS
55 +#if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS || defined(__GNU__)
56 UNIXVFS("unix-posix", posixIoFinder ),
57 #endif
58 #if SQLITE_ENABLE_LOCKING_STYLE