Skip to content

[FEAT] exePath Implementation for OpenBSD #2195

@samuelvenable

Description

@samuelvenable

Description

It is technically possible to do, even if there are a few failure cases. For instance, here's a C++ project I wrote which does it: https://github.com/samuelvenable/OpenBSD-Get-Executable-Path The code would need to be rewritten to be in C, but the same basic code logic would be used. Some of the code logic might be omitted or considered redundant depending on your needs. OpenBSD has no official API for this, so I admit, writing our own solution is pretty hacky. It tests against the ino_t and dev_t of the file to make sure it matches up with a valid hard link to the exact intended file. It returns an empty string when it fails, as you documented. I got help from the OpenBSD mailing lists to write this solution, so it's as good as it things get.

The only dependencies are libc and libkvm which are provided by OpenBSD's base system.

Motivation

This is mainly for consistency with other platforms. OpenBSD is the only platform missing this feature.

https://github.com/fastfetch-cli/fastfetch/blob/a1e20270ad76a38d9098fe404acfac472820e67c/src/common/impl/FFPlatform_unix.c#L49C9-L49C31

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions