Support for NetBSD
0323pin opened this issue · comments
Hi,
Would it be possible to add support for NetBSD, starship/starship#4076 ?
Added a dummy implementation (only shared unix
things will work), can you test that the example builds and runs?
(I don't exactly have the resources to develop further support for a platform I don't personally use, but PRs always welcome)
@unrelentingtech Thanks! At least it won't stop things that depend on systemstat
to build. I don't know when or if I will manage to create a PR adding real support but, at least I think I can look at libmacchina
which supports NetBSD for inspiration.
can you test that the example builds and runs?
Sure, will do that during the weekend.
@unrelentingtech Ops!
Compiling systemstat v0.1.11 (/usr/pkgsrc/wip/systemstat/work/systemstat-bdbad620117312c768868384d9a338a22f03b538)
error: cannot find macro `lazy_static` in this scope
--> src/platform/bsd.rs:4:1
|
4 | lazy_static! {
| ^^^^^^^^^^^
|
= note: consider importing this macro:
lazy_static::lazy_static
note: `lazy_static` is imported here, but it is a crate, not a macro
--> src/lib.rs:8:1
|
8 | extern crate lazy_static;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:16:27
|
16 | fn cpu_load(&self) -> io::Result<DelayedMeasurement<Vec<CPULoad>>> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:17:28
|
17 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:20:31
|
20 | fn load_average(&self) -> io::Result<LoadAverage> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:24:25
|
24 | fn memory(&self) -> io::Result<Memory> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:25:28
|
25 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:28:23
|
28 | fn swap(&self) -> io::Result<Swap> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:29:28
|
29 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:32:28
|
32 | fn boot_time(&self) -> io::Result<DateTime<Utc>> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:33:28
|
33 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:36:31
|
36 | fn battery_life(&self) -> io::Result<BatteryLife> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:37:28
|
37 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:40:30
|
40 | fn on_ac_power(&self) -> io::Result<bool> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:41:28
|
41 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:44:25
|
44 | fn mounts(&self) -> io::Result<Vec<Filesystem>> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:45:28
|
45 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `path`
--> src/platform/netbsd.rs:48:26
|
48 | fn mount_at<P: AsRef<path::Path>>(&self, _: P) -> io::Result<Filesystem> {
| ^^^^ use of undeclared crate or module `path`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:48:55
|
48 | fn mount_at<P: AsRef<path::Path>>(&self, _: P) -> io::Result<Filesystem> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:49:28
|
49 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:52:42
|
52 | fn block_device_statistics(&self) -> io::Result<BTreeMap<String, BlockDeviceStats>> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:53:28
|
53 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:56:27
|
56 | fn networks(&self) -> io::Result<BTreeMap<String, Network>> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:60:49
|
60 | fn network_stats(&self, interface: &str) -> io::Result<NetworkStats> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:61:28
|
61 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:64:27
|
64 | fn cpu_temp(&self) -> io::Result<f32> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:65:28
|
65 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:68:31
|
68 | fn socket_stats(&self) -> io::Result<SocketStats> {
| ^^ use of undeclared crate or module `io`
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:69:28
|
69 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^ use of undeclared crate or module `io`
error[E0412]: cannot find type `PlatformMemory` in this scope
--> src/data.rs:289:26
|
289 | pub platform_memory: PlatformMemory,
| ^^^^^^^^^^^^^^ not found in this scope
error[E0412]: cannot find type `PlatformSwap` in this scope
--> src/data.rs:319:24
|
319 | pub platform_swap: PlatformSwap,
| ^^^^^^^^^^^^ not found in this scope
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:17:17
|
17 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:25:17
|
25 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:29:17
|
29 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:33:17
|
33 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:37:17
|
37 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:41:17
|
41 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:45:17
|
45 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:49:17
|
49 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:53:17
|
53 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:61:17
|
61 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:65:17
|
65 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
error[E0433]: failed to resolve: use of undeclared crate or module `io`
--> src/platform/netbsd.rs:69:17
|
69 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^ not found in `io`
|
help: consider importing one of these items
|
1 | use core::fmt::Error;
|
1 | use std::error::Error;
|
1 | use std::fmt::Error;
|
1 | use std::io::Error;
|
warning: unused import: `super::bsd`
--> src/platform/netbsd.rs:1:5
|
1 | use super::bsd;
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Some errors have detailed explanations: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
warning: `systemstat` (lib) generated 1 warning
error: could not compile `systemstat` due to 42 previous errors; 1 warning emitted
*** Error code 101
I should really get my hands dirty 😄
Try again
@unrelentingtech sure
Compiling systemstat v0.1.11 (/usr/pkgsrc/wip/systemstat/work/systemstat-9cf36abb4ab5c21635619e6163004e5299092881)
error[E0433]: failed to resolve: use of undeclared crate or module `path`
--> src/platform/netbsd.rs:49:26
|
49 | fn mount_at<P: AsRef<path::Path>>(&self, _: P) -> io::Result<Filesystem> {
| ^^^^ use of undeclared crate or module `path`
error[E0283]: type annotations needed
--> src/platform/netbsd.rs:50:13
|
50 | Err(io::Error::new(io::ErrorKind::Other, "Not supported"))
| ^^^^^^^^^^^^^^ cannot infer type for struct `Box<(dyn std::error::Error + Send + Sync + 'static)>`
|
= note: multiple `impl`s satisfying `Box<(dyn std::error::Error + Send + Sync + 'static)>: ~const From<&str>` found in the `std` crate:
- impl<'a, E> From<E> for Box<(dyn std::error::Error + Send + Sync + 'a)>
where E: 'a, E: std::error::Error, E: Send, E: Sync;
- impl<'a> From<&str> for Box<(dyn std::error::Error + Send + Sync + 'a)>;
= note: required because of the requirements on the impl of `Into<Box<(dyn std::error::Error + Send + Sync + 'static)>>` for `&str`
note: required by a bound in `std::io::Error::new`
Some errors have detailed explanations: E0283, E0433.
For more information about an error, try `rustc --explain E0283`.
error: could not compile `systemstat` due to 2 previous errors
hopefully that was the last one lol
@unrelentingtech Good! Just a warning now,
Compiling systemstat v0.1.11 (/usr/pkgsrc/wip/systemstat/work/systemstat-9423c9157571fcc455189ca6311e73ff97fb9aec)
warning: unused variable: `interface`
--> src/platform/netbsd.rs:61:29
|
61 | fn network_stats(&self, interface: &str) -> io::Result<NetworkStats> {
| ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_interface`
|
= note: `#[warn(unused_variables)]` on by default
warning: `systemstat` (lib) generated 1 warning
Finished release [optimized] target(s) in 21.60s
Thanks!
@unrelentingtech would it be possible to provide a new release in order to allow other projects that depend on systemstat
to build on NetBSD?
Thanks!
Released 0.1.12 and 0.2.0.
Thank you!