Skip to content

Missing POSIX confstr and _CS_* symbols on Linux. #3767

Closed
@jgarzik

Description

@jgarzik

Apple Darwin provides the POSIX standard confstr(3) function and associated _CS_* symbols. Tested on Darwin and is working.

Requesting the same for Linux.

Quoting src/unix/bsd/apple/mod.rs:

// `confstr` keys (only the values guaranteed by `man confstr`).
pub const _CS_PATH: ::c_int = 1;
pub const _CS_DARWIN_USER_DIR: ::c_int = 65536;
pub const _CS_DARWIN_USER_TEMP_DIR: ::c_int = 65537;
pub const _CS_DARWIN_USER_CACHE_DIR: ::c_int = 65538;
...
    #[cfg_attr(
        all(target_os = "macos", target_arch = "x86"),
        link_name = "confstr$UNIX2003"
    )]
    pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t

The Linux version for this crate should be very similar. The Linux man page for confstr(3) also helpfully lists the few key _CS_* symbols that the developer should expect to be available:

       _CS_GNU_LIBC_VERSION (GNU C library only; since glibc 2.3.2)
       _CS_GNU_LIBPTHREAD_VERSION (GNU C library only; since glibc 2.3.2)
       _CS_PATH

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions