Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Illumos/Solaris #63

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

# Not supported by flock:
# - plan9/*
# - solaris/*
# - js/wasm
# - wasp1/wasm

for row in $(go tool dist list -json | jq -r '.[] | select( .GOOS != "plan9" and .GOOS != "solaris" and .GOARCH != "wasm") | @base64'); do
for row in $(go tool dist list -json | jq -r '.[] | select( .GOOS != "plan9" and .GOARCH != "wasm") | @base64'); do
_jq() {
echo ${row} | base64 --decode | jq -r ${1}
}
Expand Down
2 changes: 1 addition & 1 deletion flock.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (f *Flock) setFh() error {
// open a new os.File instance
// create it if it doesn't exist, and open the file read-only.
flags := os.O_CREATE
if runtime.GOOS == "aix" {
if runtime.GOOS == "aix" || runtime.GOOS == "solaris" || runtime.GOOS == "illumos" {
// AIX cannot preform write-lock (ie exclusive) on a
// read-only file.
flags |= os.O_RDWR
Expand Down
2 changes: 1 addition & 1 deletion flock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (s *TestSuite) TestFlock_TryRLock() {
locked, err = flock2.TryRLock()
s.Require().NoError(err)

if runtime.GOOS == "aix" {
if runtime.GOOS == "aix" || runtime.GOOS == "solaris" || runtime.GOOS == "illumos" {
// When using POSIX locks, we can't safely read-lock the same
// inode through two different descriptors at the same time:
// when the first descriptor is closed, the second descriptor
Expand Down
2 changes: 1 addition & 1 deletion flock_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Use of this source code is governed by the BSD 3-Clause
// license that can be found in the LICENSE file.

//go:build !aix && !windows
//go:build !aix && !solaris && !windows

package flock

Expand Down
2 changes: 1 addition & 1 deletion flock_aix.go → flock_unix_variants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// This code is adapted from the Go package:
// cmd/go/internal/lockedfile/internal/filelock

//go:build aix
//go:build aix || solaris

package flock

Expand Down