rust/compiler/rustc_data_structures
Dylan DPC 56b7786914
Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtwco,michaelwoerister
Fix RSS reporting on macOS

> NOTE: This is a duplicate of #98164, which I closed because I borked my rustc fork

Currently, `rustc_data_structures::profiling::get_resident_set_size()` always returns `None` on macOS. This is because
macOS does not implement procfs used in the unix version of the function:

```rust
...
else if #[cfg(unix)] {
        pub fn get_resident_set_size() -> Option<usize> {
            let field = 1;
            let contents = fs::read("/proc/self/statm").ok()?;
            let contents = String::from_utf8(contents).ok()?;
            let s = contents.split_whitespace().nth(field)?;
            let npages = s.parse::<usize>().ok()?;
            Some(npages * 4096)
        }
...
```

The proposed solution uses libproc, and more specifically `proc_pidinfo`, which has been available on macOS since 10.5 if the function signature inside libproc.h is to be believed:

```c
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
```
2022-06-28 15:30:03 +05:30
..
src Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtwco,michaelwoerister 2022-06-28 15:30:03 +05:30
Cargo.toml Update to rebased rustc-rayon 0.4 2022-05-27 20:20:41 -07:00