about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass-dep/libc/libc-sysconf.rs
blob: b832b3033b76ec63b2758cf90e5c6d4538e7c98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ignore-target: windows # Supported only on unixes

fn test_sysconfbasic() {
    unsafe {
        let ncpus = libc::sysconf(libc::_SC_NPROCESSORS_CONF);
        assert!(ncpus >= 1);
        let psz = libc::sysconf(libc::_SC_PAGESIZE);
        assert!(psz % 4096 == 0);
        // note that in reality it can return -1 (no hard limit) on some platforms.
        let gwmax = libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX);
        assert!(gwmax >= 512);
        let omax = libc::sysconf(libc::_SC_OPEN_MAX);
        assert_eq!(omax, 65536);
    }
}

fn main() {
    test_sysconfbasic();
}