-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add AIX support with fcntl #40
Conversation
I plan to do a review of this with the intent to merge it. One concern I have is that without an AIX test environment, we can't be confident in our implementation when making future changes. I'm doing some research on that, but not looking promising. 😄 |
I'm not sure there is any "free" AIX which can be used for testing. |
Hi Theckman, Any news about this PR ? |
flock_aix.go
Outdated
// Copyright 2019 Tim Heckman. All rights reserved. Use of this source code is | ||
// governed by the BSD 3-Clause license that can be found in the LICENSE file. | ||
|
||
// This code implements the filelock API using POSIX 'fcntl' locks, which attach | ||
// to an (inode, process) pair rather than a file descriptor. To avoid unlocking | ||
// files prematurely when the same file is opened through different descriptors, | ||
// we allow only one read-lock at a time. | ||
// | ||
// This code is adapted from the Go package: | ||
// cmd/go/internal/lockedfile/internal/filelock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The portions of this implementation taken from the Go project should carry the Go license and copyright notice.
(It is of course fine to combine that code with other compatibly-licensed code, but it is important to comply with the terms of the license.)
Hi Theckman, Any news about this PR ? |
@fearful-symmetry, I'm not in the |
@bcmills anyone I should ping about getting this updated/approved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Helflym @fearful-symmetry @bcmills apologies, my hesitation has been that there are zero AIX build resources available for the community and it looked prohibitively expensive to try and learn AIX / gain access to one.
At this point I'm okay ignoring that discomfort and merging this in for the benefit of the community, but there is a blocker in getting this merged. There were some changes released in v0.7.2 (#43) that need to be included here and tested on an AIX system.
Is there someone with access to AIX hardware that can develop / test that change?
AIX doesn't provide a true flock() syscall. It does exist but it's just a wrapper around fcntl. It doesn't provide safe locks under file descriptors of a same process. The current implementation is based on the file cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go. Using fcntl implementation doesn't allow to have several RLocks at the same time as closing a file descriptor might release the lock if even others RLocks remain attached.
Yeah, it's not really possible. IBM doesn't provide free AIX VM for OpenSource developers... As I said for other Go packages, the AIX community should report if anything go wrong and should be able to fix it. Anyway, you can tag me if you want some tests on AIX.
I've made the change it and the tests are all OK. |
@Helflym thank you! I'll work to get v0.8.0 out within the next 10-15 minutes. |
AIX doesn't provide a true flock() syscall. It does exist but it's just
a wrapper around fcntl. It doesn't provide safe locks under file
descriptors of a same process.
The current implementation is based on the file
cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go.
Using fcntl implementation doesn't allow to have several RLocks at the
same time as closing a file descriptor might release the lock if even
others RLocks remain attached.