Use libc crate correctly, and future-proof
Since libc
became an optional dependency for pthread struct ABI checking, it has been used accidentally instead of relibc's own definitions, which this MR fixes.
Also fixes some unsound header APIs, which should be marked unsafe but weren't, and uses the newest libc crate so the Cargo patch is no longer needed. And runs rustfmt, finally fixing CI again.
Edited by Jacob Lorentzon