Skip to content

Add a feature + cfg attribute to exclude GNU extension functions #1116

Closed
@shravanrn

Description

@shravanrn

Hi,
I was wondering if it would be possible to add a feature flag and the appropriate cfg calls to separate POSIX functions from the GNU specific extensions (usable when _GNU_SOURCE is defined).

My use case is as follows. I am using some packages (lucet) that have a dependency on the nix packages. While I'm using these packages in a Linux system, we are linking against libraries without the GNU extension functions... Thus the presence of calls to process_vm_writev, process_vm_readv and setns is causing problems. Additionally, it seems that the nix wrappers for these functions cannot be eliminated by dead code removal, and so persist in the final library, resulting in missing symbol errors.

Currently, it seems that these functions are protected only with #[cfg(any(target_os = "linux"))]. Thus the easiest workaround that comes to mind is to pretend that target_os is not linux, but this feels hacky at best... I was wondering if it would be possible to add a new feature flag which we can set at compile time, that would exclude these GNU specific functions...

(also, I apologize if I got some details wrong... I'm still quite new to rust :) )

Please let me know... If required, I am also happy to contribute a patch for the same...

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