Skip to content

"Detecting whether functions are supported at runtime" in docs is misleading #665

Closed
@safinaskar

Description

@safinaskar

https://docs.rs/rustix/0.37.19/rustix/ says: "Things they don’t do include: Detecting whether functions are supported at runtime". But this seams to be not true. Consider this code:

Err(io::Errno::NOSYS) => statat_old(dirfd, path, flags),
. Here we do exactly what we promised not to do: we detect in runtime whether statx is supported. If not, we fail back to another function. This is bad for two reasons:

  • This contradicts docs
  • This will work badly in many container runtimes in Linux. Runtimes usually return EPERM is they don't know this syscall (this often happens if we run new system in old container runtime). But you check here for ENOSYS only, not for EPERM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions