Skip to content

fcntl module provides no access to F_GETLK operation #96694

@eqvinox

Description

@eqvinox

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions