`fcntl` module provides no access to F_GETLK operation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Wrapper/access for fcntl(fd, F_GETLK, …)
The fcntl module currently exposes the F_GETLK constant itself, but unfortunately because the types in struct flock are OS and CFLAGS dependent (off_t, pid_t), the operation is hard to work-around with struct.unpack.
Pitch
Exposing F_GETLK is particularly useful to determine if a process that created a lock file or pid file is actually still alive, vs. whether the lock/pid file was left uncleaned from a previous exit/crash/etc. The l_pid field is the most useful, but if wrapping the call anyway it might make more sense to just expose all values.
I've already implemented this, a PR is following shortly.
Linked PRs
- gh-112372
- gh-96695
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fcntl module's existing F_GETLK constant and review the platform-dependent struct flock types described in the issue. Check linked PRs gh-112372 and gh-96695 before starting, since the requested implementation is already reported as complete. Done means exposing F_GETLK access without requiring callers to guess OS- and CFLAGS-dependent layouts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100