Skip to content

Commit 5d5c302

Browse files
committed
Support for z/OS.
Support is behind sqlite3_flock build tag, and tested through s390x Linux. See #86.
1 parent 10c4940 commit 5d5c302

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,6 @@ jobs:
145145

146146
- name: Test riscv64
147147
run: GOARCH=riscv64 go test -v -short ./...
148+
149+
- name: Test s390x (like z/OS)
150+
run: GOARCH=s390x go test -v -short -tags sqlite3_flock ./...

vfs/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ However, concurrency is reduced with BSD locks
3131
On Windows, this module uses `LockFileEx` and `UnlockFileEx`,
3232
like SQLite.
3333

34+
On Linux and z/OS, BSD locks are fully functional,
35+
but incompatible with POSIX advisory locks (and SQLite).
36+
You can opt into BSD locks with the `sqlite3_flock` build tag.
37+
3438
On all other platforms, file locking is not supported, and you must use
3539
[`nolock=1`](https://sqlite.org/uri.html#urinolock)
3640
(or [`immutable=1`](https://sqlite.org/uri.html#uriimmutable))

vfs/lock_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func Test_vfsLock(t *testing.T) {
105105
t.Fatal("returned", rc)
106106
}
107107
if got := util.ReadUint32(mod, pOutput); got == 0 {
108-
t.Error("file wasn't locked")
108+
t.Log("file wasn't locked, locking is incompatible with SQLite")
109109
}
110110
rc = vfsCheckReservedLock(ctx, mod, pFile2, pOutput)
111111
if rc != _OK {
@@ -132,7 +132,7 @@ func Test_vfsLock(t *testing.T) {
132132
t.Fatal("returned", rc)
133133
}
134134
if got := util.ReadUint32(mod, pOutput); got == 0 {
135-
t.Error("file wasn't locked")
135+
t.Log("file wasn't locked, locking is incompatible with SQLite")
136136
}
137137
rc = vfsCheckReservedLock(ctx, mod, pFile2, pOutput)
138138
if rc != _OK {
@@ -159,7 +159,7 @@ func Test_vfsLock(t *testing.T) {
159159
t.Fatal("returned", rc)
160160
}
161161
if got := util.ReadUint32(mod, pOutput); got == 0 {
162-
t.Error("file wasn't locked")
162+
t.Log("file wasn't locked, locking is incompatible with SQLite")
163163
}
164164
rc = vfsCheckReservedLock(ctx, mod, pFile2, pOutput)
165165
if rc != _OK {

vfs/os_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !sqlite3_flock && !sqlite3_nosys
1+
//go:build !(sqlite3_flock || sqlite3_nosys)
22

33
package vfs
44

vfs/os_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !sqlite3_nosys
1+
//go:build !(sqlite3_flock || sqlite3_nosys)
22

33
package vfs
44

vfs/os_unix_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build unix && !sqlite3_flock && !sqlite3_nosys
1+
//go:build unix && !(sqlite3_flock || sqlite3_nosys)
22

33
package vfs
44

0 commit comments

Comments
 (0)