Skip to content

Expose API availability to downstream crates #232

Description

@kamalmarhubi

Lots of system APIs get new flag values added over time, or have other changes. Also, some APIs are available on many but not all platforms. It would be ideal if libc made this available downstream in a better way than having undefined items. This would allow progressive enhancement based on the target system's capabilities.

My main idea is to provide a library that downstream projects can use in their build scripts. The library would make it easy to define features that can be used in cfg attributes in the downstream project.

Examples

The tempfile crate could use open(2) with O_TMPFILE on Linux 3.11+ where it exists, and fall back to mkstemp(3) + unlink(2) where it doesn't.

A server might use vmsplice(2) on Linux to avoid copies, with write(2) or send(2) as a fallback.


This could be provided by a third party crate as the maintenance burden is fairly high, and the testing story would be a bit rough. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions