mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
netdev can't be seeked anymore?
This commit is contained in:
parent
45dd7bd85f
commit
76da726559
1 changed files with 2 additions and 4 deletions
|
|
@ -173,14 +173,12 @@ impl SensorSource for CpuTimeSource {
|
|||
}
|
||||
|
||||
pub struct NetworkSource {
|
||||
source: File,
|
||||
buff: String,
|
||||
}
|
||||
|
||||
impl NetworkSource {
|
||||
pub fn new() -> Result<NetworkSource> {
|
||||
Ok(NetworkSource {
|
||||
source: File::open("/proc/net/dev").context("error opening netdev")?,
|
||||
buff: String::new(),
|
||||
})
|
||||
}
|
||||
|
|
@ -230,8 +228,8 @@ impl MultiSensorSource for NetworkSource {
|
|||
|
||||
fn read(&mut self) -> Result<Self::Iter<'_>> {
|
||||
self.buff.clear();
|
||||
self.source.rewind().context("error rewinding netdev")?;
|
||||
self.source
|
||||
let mut source = File::open("/proc/net/dev").context("error opening netdev")?;
|
||||
source
|
||||
.read_to_string(&mut self.buff)
|
||||
.context("error reading netdev")?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue