| 3124 | |
| 3125 | #[cfg(target_os = "linux")] |
| 3126 | fn check_gpu_privileges() -> Result<(), String> { |
| 3127 | if !rustix::process::geteuid().is_root() { |
| 3128 | return Err( |
| 3129 | "GPU support requires root privileges for VFIO bind/unbind and TAP networking. \ |
| 3130 | Run with sudo or ensure CAP_SYS_ADMIN + CAP_NET_ADMIN capabilities are set." |
| 3131 | .to_string(), |
| 3132 | ); |
| 3133 | } |
| 3134 | Ok(()) |
| 3135 | } |
| 3136 | |
| 3137 | // `tonic::Status` is ~176 bytes; it's the standard error type across the |
| 3138 | // gRPC API surface, so boxing here would diverge from every other handler. |