[Virtio-fs] [virtiofsd-rs] MR opened: Check for statx() in the libc

virtiofs-bot at sinrega.org virtiofs-bot at sinrega.org
Wed Apr 21 16:11:10 UTC 2021


This patch should resolve issue #12.

It adds a build.rs file that auto-detects whether the system libc has `statx()` (by compiling and linking a small C test program), and if there is no `statx()`, the wrapper in src/passthrough/stat.rs is replaced by a stub that returns `ENOSYS`.

Auto-detection can be skipped and overridden by enabling either the enable-statx or the disable-statx feature.  (A tri-state would be nice, but there are no tri-state features.)

I’m not sure whether we should add something like
```rust
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=build.rs-files");
```

I decided to rather be wary (and not include those lines), because I don’t know whether cargo would rerun build.rs when e.g. the feature selection changes, or maybe when there is a system update and suddenly the system libc has `statx()`.  For the time being, running build.rs also takes little time, so it isn’t a real problem.
---
https://gitlab.com/virtio-fs/virtiofsd-rs/-/merge_requests/22




More information about the Virtio-fs mailing list