Skip to content

proposal: consolidate libc::mode_t abstraction #7751

@nyurik

Description

@nyurik

I was hacking on #7728, trying to get rid of numerous suspiscious u32 casts, and realized that many of them have to do with libc::mode_t alias. In most unix-like OS, it uses u32, but some use u16 and Redux uses i32, making this somewhat problematic.

Coreutils code constantly casts from mode_t to u32 and back. I think a better paradigm might be to introduce a dedicated type, probably based on bitflags? In general, a strongly typed flag type should be better than a generic u32 passed around. My only reservation is that maybe this should be part of libc itself?

See also rust-lang/libc#4404

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