Skip to content

O_LARGEFILE missing on some platforms #4358

Closed as not planned
Closed as not planned
@brian-pane

Description

@brian-pane

O_LARGEFILE isn't defined in the libc crate on some platforms. For example, this code:

use libc::{O_CREAT, O_LARGEFILE, O_EXCL};

fn main() {
    let _ = O_CREAT | O_LARGEFILE | O_EXCL;
}

yields a compiler error on aarch64-apple-darwin, where O_LARGEFILE doesn't exist.

I ran into this while porting a C library to Rust. Since the C libc doesn't have O_LARGEFILE on all platforms, the C idiom is:

#ifdef O_LARGEFILE
   ...
#endif

On targets where the C libc doesn't have a O_LARGEFILE, would it make sense for Rust libc to provide

const O_LARGEFILE: c_int = 0;

to support apps that need to compile for many platforms? If so, I'm willing to submit a PR to cover the macOS case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions