commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
a150bb4d76b69de849bb126aed09265c8d7c8c53 | Guillaume Gomez | 2023-10-31T17:15:35 | Move cgroup limits computation into its own function to split it out from the "normal" memory values | diff --git a/src/common.rs b/src/common.rs
index d6710be..22ab064 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -458,6 +458,9 @@ impl System {
/// let s = System::new_all();
/// println!("{} bytes", s.total_memory());
/// ```
+ ///
+ /// On Linux, if you want to see this information with the li... | 8 | 122 | 38 |
28e3b2b4d1d8e1eaaa1463a2c4ac2274d637bf17 | Guillaume Gomez | 2023-10-31T16:23:29 | Split cgroup refresh into its own function | diff --git a/src/unix/linux/system.rs b/src/unix/linux/system.rs
index cfa0f44..e8a68d5 100644
--- a/src/unix/linux/system.rs
+++ b/src/unix/linux/system.rs
@@ -225,6 +225,10 @@ impl SystemInner {
.saturating_sub(self.mem_shmem);
}
+ self.refresh_cgroup();
+ }
+
+ fn refresh_cgr... | 1 | 4 | 0 |
024829315332d300ac80fb5e7d5840c1bb88bac0 | Nicolas | 2023-10-31T14:30:58 | Add Sonoma to long OS version | diff --git a/src/unix/apple/system.rs b/src/unix/apple/system.rs
index 2185062..e27628a 100644
--- a/src/unix/apple/system.rs
+++ b/src/unix/apple/system.rs
@@ -341,6 +341,7 @@ impl SystemInner {
pub(crate) fn long_os_version(&self) -> Option<String> {
#[cfg(target_os = "macos")]
let friendly_nam... | 1 | 1 | 0 |
db9ab5a6cf2f9aa16566e0392f82ad6aa1d583a1 | Guillaume Gomez | 2023-10-30T20:13:04 | Fix rustc "unused import" warning | diff --git a/src/unix/apple/ffi.rs b/src/unix/apple/ffi.rs
index 7282220..a1b341d 100644
--- a/src/unix/apple/ffi.rs
+++ b/src/unix/apple/ffi.rs
@@ -6,6 +6,7 @@ use core_foundation_sys::{
};
// Reexport items defined in either macos or ios ffi module.
+#[cfg(not(target_os = "ios"))]
pub use crate::sys::inner::ffi:... | 1 | 1 | 0 |
54e5dfd076a87af01025f3c7c92453743307001a | Guillaume Gomez | 2023-10-24T13:02:58 | Fix new clippy lint | diff --git a/src/windows/cpu.rs b/src/windows/cpu.rs
index 98fd549..6424839 100644
--- a/src/windows/cpu.rs
+++ b/src/windows/cpu.rs
@@ -305,7 +305,7 @@ impl CpusWrapper {
}
self.global
.inner
- .set_frequency(self.cpus.get(0).map(|cpu| cpu.frequency()).unwrap_or(0));
+ ... | 1 | 1 | 1 |
f5acb92cbaf459d2155ed930acca488d05c0db2b | Jimmy Ruan | 2023-10-24T12:48:43 | Implement Display for DiskKind | diff --git a/src/common.rs b/src/common.rs
index e65cc54..d6710be 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2173,6 +2173,16 @@ pub enum DiskKind {
Unknown(isize),
}
+impl fmt::Display for DiskKind {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_str(match *self {
+ ... | 1 | 10 | 0 |
1c56503ec2919ea9ae734e80bfe2d5204fc32f89 | Guillaume Gomez | 2023-10-21T15:36:44 | Add missing serde implementations | diff --git a/src/serde.rs b/src/serde.rs
index 90b5ddf..5fb6211 100644
--- a/src/serde.rs
+++ b/src/serde.rs
@@ -1,8 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::{DiskKind, DiskUsage, MacAddr, ProcessStatus, Signal};
use serde::{ser::SerializeStruct, Serialize,... | 1 | 89 | 85 |
ced0029503d54b48afe28c433e6a368e6b09c061 | Christian Klauser | 2023-10-20T21:35:53 | Change `Disk::file_system()` to return `&OsStr` | diff --git a/src/common.rs b/src/common.rs
index f348527..e65cc54 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1922,7 +1922,7 @@ impl Disk {
/// println!("[{:?}] {:?}", disk.name(), disk.file_system());
/// }
/// ```
- pub fn file_system(&self) -> &[u8] {
+ pub fn file_system(&self) -> &O... | 7 | 50 | 38 |
b19e71b2252ef43424ebb0348b9ebf89b0aec473 | Guillaume Gomez | 2023-10-20T20:53:20 | Fix comment typo | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index 16db770..641fc2d 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -99,7 +99,7 @@ pub(crate) unsafe fn get_volume_path_names_for_volume_name(
.map_err(|_| match GetLastError() {
Ok(_) => {
sysinfo... | 1 | 1 | 1 |
6d6b1f28b84397dbc4450e21b360751578553c7f | Christian Klauser | 2023-10-20T20:17:21 | Fix typo in comment. | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index 29c9f81..16db770 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -99,7 +99,7 @@ pub(crate) unsafe fn get_volume_path_names_for_volume_name(
.map_err(|_| match GetLastError() {
Ok(_) => {
sysinfo... | 1 | 1 | 1 |
e6117a0ac6527feacd916e992bf787afc63bb4be | Christian Klauser | 2023-10-20T17:25:27 | Address stylistic review findings | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index 5a809c5..29c9f81 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -9,7 +9,8 @@ use std::path::Path;
use windows::core::PCWSTR;
use windows::Win32::Foundation::{
- CloseHandle, GetLastError, ERROR_MORE_DATA, ERROR_NO_MORE_FILES, HANDLE, MAX... | 1 | 23 | 14 |
f565d2682b8cc629fa2f239bd49ae8c8c50d9940 | Christian Klauser | 2023-10-20T09:12:58 | Fix accidentally inverted `is_empty()` condition
(Didn't pay enough attention when I applied clippy's suggestions 😅 ) | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index 572b170..5a809c5 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -276,7 +276,7 @@ pub(crate) unsafe fn get_list() -> Vec<Disk> {
}
let mount_paths = get_volume_path_names_for_volume_name(&volume_name[..]);
- ... | 1 | 1 | 1 |
df88a4fc8dad1f887dacd5b5d14ae807029e2d8e | Christian Klauser | 2023-10-19T22:23:22 | Clippy: prefer is_empty() | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index 5a53ed0..92d8ece 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -108,7 +108,7 @@ pub(crate) unsafe fn get_volume_path_names_for_volume_name(volume_guid_path: &[u
// An additional zero terminates the list.
let mut path_names = Vec::new... | 1 | 2 | 2 |
d03e3b5ab7f322e59646460985f8ce5135f18126 | Christian Klauser | 2023-10-19T20:39:16 | Windows: enumerate drives via FindNextVolumeW + GetVolumePathNamesForVolumeNameW
This PR changes the mechanism for enumerating "disks" on windows. The previous approach only worked for volumes that were assigned a drive letter. Windows volumes can also be mounted in the file system.
We first fetch a list of volume GU... | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index e7e5b18..5a53ed0 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -4,14 +4,16 @@ use crate::{Disk, DiskKind};
use std::ffi::{c_void, OsStr, OsString};
use std::mem::size_of;
+use std::os::windows::ffi::OsStringExt;
use std::path::Path;
us... | 1 | 142 | 55 |
311f5307609bb476e54572e7d9da383eddbc09ca | Guillaume Gomez | 2023-10-16T22:07:26 | Remove `sort_by` methods | diff --git a/src/common.rs b/src/common.rs
index f812d33..e5e4924 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2090,32 +2090,6 @@ impl Disks {
self.inner.disks_mut()
}
- /// Sort the disk list with the provided callback.
- ///
- /// Internally, it is using the [`slice::sort_unstable_by`] ... | 1 | 0 | 78 |
71eb1d6a668e2a7d38d907d7c9b4d72882ed1d4f | Guillaume Gomez | 2023-10-15T20:49:12 | Add missing warning for Windows support for `System::load_average` | diff --git a/src/common.rs b/src/common.rs
index fedee64..5d0cfeb 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -572,6 +572,8 @@ impl System {
/// Returns the system load average value.
///
+ /// ⚠️ This is currently not working on **Windows**.
+ ///
/// ```no_run
/// use sysinfo::System... | 1 | 2 | 0 |
c305d24bd5bb0f4e8c628a8c0375e85d2848c340 | Guillaume Gomez | 2023-10-15T20:46:05 | Implement `IntoIterator` for `Disks`, `Components` and `Users` types | diff --git a/src/common.rs b/src/common.rs
index fedee64..53858c2 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2021,6 +2021,24 @@ impl Default for Disks {
}
}
+impl<'a> IntoIterator for &'a Disks {
+ type Item = &'a Disk;
+ type IntoIter = std::slice::Iter<'a, Disk>;
+
+ fn into_iter(self) -> Sel... | 1 | 75 | 21 |
1be44755e8737aa86ba756a20055878fcdf453a1 | Guillaume Gomez | 2023-10-15T14:00:31 | Remove UsersExt trait | diff --git a/benches/basic.rs b/benches/basic.rs
index 48fa885..784aebe 100644
--- a/benches/basic.rs
+++ b/benches/basic.rs
@@ -3,7 +3,6 @@
extern crate test;
use sysinfo::get_current_pid;
-use sysinfo::UsersExt;
#[bench]
fn bench_new(b: &mut test::Bencher) {
diff --git a/examples/simple.rs b/examples/simple.r... | 5 | 136 | 160 |
826300aefe661762d1465c4a3065e37a5918705e | Guillaume Gomez | 2023-10-14T21:56:46 | Correctly retrieve process root directory on mac | diff --git a/src/unix/apple/macos/process.rs b/src/unix/apple/macos/process.rs
index cad8c05..b690049 100644
--- a/src/unix/apple/macos/process.rs
+++ b/src/unix/apple/macos/process.rs
@@ -1,6 +1,5 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use std::ffi::CStr;
use std::mem::... | 2 | 49 | 74 |
813f247a01980ab08e12b228eaac9a51420c546f | Guillaume Gomez | 2023-10-14T12:36:25 | Remove GroupExt trait | diff --git a/src/common.rs b/src/common.rs
index 0bbb551..dd94022 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::{
- ComponentInner, Components, ComponentsExt, CpuInner, GroupExt, NetworkDataInner, Networks... | 4 | 35 | 62 |
bc86118daddcce3b10dc6f7533d0309b120835eb | Vincent Thiberville | 2023-09-29T14:33:54 | fix: refresh process memory on Windows on first update
The first time a process is refreshed on windows, its memory values are
not fetched. This is only done on a second refresh.
Fix this my moving the refresh memory into the process update function. | diff --git a/src/windows/process.rs b/src/windows/process.rs
index d3e3299..c09d603 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -489,6 +489,7 @@ impl ProcessInner {
if refresh_kind.disk_usage() {
update_disk_usage(self);
}
+ update_memory(self);
sel... | 3 | 22 | 2 |
db4e98966e404501e1b3758f112bfae17a5afa78 | Guillaume Gomez | 2023-09-25T11:52:46 | Use `crate::` for local items and add extra information on global CPU | diff --git a/src/lib.rs b/src/lib.rs
index d30ecc7..06f9f77 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,7 +18,7 @@ cfg_if::cfg_if! {
if #[cfg(feature = "unknown-ci")] {
// This is used in CI to check that the build for unknown targets is compiling fine.
mod unknown;
- use unknown as sy... | 2 | 13 | 8 |
a9b9f52065369a7a8592c77cbcb41c19501cf1a9 | Guillaume Gomez | 2023-09-24T22:33:47 | Add regression test for CPU brand and vendor ID | diff --git a/tests/cpu.rs b/tests/cpu.rs
index edcd575..f931ceb 100644
--- a/tests/cpu.rs
+++ b/tests/cpu.rs
@@ -6,17 +6,26 @@
fn test_cpu() {
use sysinfo::{CpuExt, SystemExt};
- if sysinfo::System::IS_SUPPORTED {
- let mut s = sysinfo::System::new();
- assert!(s.cpus().is_empty());
- s.... | 1 | 17 | 8 |
fee929846e6246ff3ddedd6b5dff1a87cebcc677 | Guillaume Gomez | 2023-09-24T22:33:27 | Correctly parse `/proc/cpuinfo` file | diff --git a/src/unix/linux/cpu.rs b/src/unix/linux/cpu.rs
index 3575bf0..455d3f4 100644
--- a/src/unix/linux/cpu.rs
+++ b/src/unix/linux/cpu.rs
@@ -737,8 +737,6 @@ pub(crate) fn get_vendor_id_and_brand() -> HashMap<usize, (String, String)> {
#[inline]
fn is_new_processor(line: &str) -> bool {
line.s... | 1 | 5 | 3 |
b46d87fc76442d1171d74d9b13cfeebaece9ee1f | Guillaume Gomez | 2023-09-24T22:25:27 | Allow to only refresh CPU info in example | diff --git a/examples/simple.rs b/examples/simple.rs
index 14fec86..f437592 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -64,6 +64,10 @@ fn print_help() {
&mut io::stdout(),
"refresh_components : reloads components information"
);
+ writeln!(
+ &mut io::stdout(),
+ ... | 1 | 19 | 7 |
3c5836184250789396d4d8710b1206e38dd22116 | Guillaume Gomez | 2023-09-24T20:01:14 | Fix `serialize_struct` field count and add a comment to prevent forgetting about it again | diff --git a/src/serde.rs b/src/serde.rs
index 2046623..c2c58b7 100644
--- a/src/serde.rs
+++ b/src/serde.rs
@@ -13,6 +13,7 @@ impl Serialize for crate::Disk {
where
S: Serializer,
{
+ // `7` corresponds to the (maximum) number of fields.
let mut state = serializer.serialize_struct("D... | 1 | 11 | 1 |
f7e4ab6686aedaf032f7e9c674f8872a36ff24fd | Guillaume Gomez | 2023-09-24T15:30:43 | Add missing checks for NULL pointers | diff --git a/src/unix/apple/disk.rs b/src/unix/apple/disk.rs
index bdf8158..8b7391e 100644
--- a/src/unix/apple/disk.rs
+++ b/src/unix/apple/disk.rs
@@ -316,7 +316,7 @@ pub(super) unsafe fn get_str_value(dict: CFDictionaryRef, key: DictKey) -> Optio
None
}
} else {
- ut... | 7 | 37 | 41 |
e249f752d9245234407a4397a1a478525e837fe9 | Guillaume Gomez | 2023-09-24T15:02:18 | Add regression test to ensure that global CPU information (frequency, brand and vendor_id) are always empty | diff --git a/tests/cpu.rs b/tests/cpu.rs
index fbeb65b..edcd575 100644
--- a/tests/cpu.rs
+++ b/tests/cpu.rs
@@ -30,3 +30,17 @@ fn test_physical_core_numbers() {
assert!(count.unwrap() > 0);
}
}
+
+#[test]
+fn test_global_cpu_info_not_set() {
+ use sysinfo::{CpuExt, SystemExt};
+
+ let mut s = sysi... | 1 | 14 | 0 |
0f817bb9adb88d52176c3a36e637bda272e4b998 | Guillaume Gomez | 2023-09-24T14:41:10 | Remove brand and vendor setup from global CPU | diff --git a/src/unix/apple/cpu.rs b/src/unix/apple/cpu.rs
index 30df454..8185edd 100644
--- a/src/unix/apple/cpu.rs
+++ b/src/unix/apple/cpu.rs
@@ -323,11 +323,6 @@ pub(crate) fn init_cpus(
}
(percentage, cpus.len())
});
-
- // We didn't set them above to avoid cloning them unnecessarily.
- ... | 5 | 5 | 22 |
298cbcb7dcf792c7e3a187f52899d1440c8e3f6c | Guillaume Gomez | 2023-09-24T14:28:12 | Fix invalid names retrieval for CPUs | diff --git a/src/unix/linux/cpu.rs b/src/unix/linux/cpu.rs
index e73ff29..b53338d 100644
--- a/src/unix/linux/cpu.rs
+++ b/src/unix/linux/cpu.rs
@@ -2,7 +2,7 @@
#![allow(clippy::too_many_arguments)]
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{BufRea... | 1 | 95 | 44 |
da800dc95c889a6fd83860df61ee3665345cfa0f | Guillaume Gomez | 2023-09-24T12:33:51 | Windows: Fix invalid use of NULL pointer | diff --git a/src/windows/users.rs b/src/windows/users.rs
index 8b1138f..bb706eb 100644
--- a/src/windows/users.rs
+++ b/src/windows/users.rs
@@ -28,14 +28,14 @@ pub struct User {
pub(crate) uid: Uid,
pub(crate) gid: Gid,
pub(crate) name: String,
- c_user_name: Vec<WCHAR>,
+ c_user_name: Option<Vec<... | 2 | 12 | 8 |
c3b613721b039445e038a62111b91565db1f4462 | Disconnect3d | 2023-09-20T09:19:04 | serde.rs: fix serialize_struct field counts
Some of the serializers used incorrect (too small) field counts when serializing structures.
This is not an issue when using JSON serializer which doesn't need the length field to operate correctly [0] but it could be an issue if a different serializer would be used in th... | diff --git a/src/serde.rs b/src/serde.rs
index 9da7e35..2046623 100644
--- a/src/serde.rs
+++ b/src/serde.rs
@@ -73,7 +73,7 @@ impl Serialize for crate::Cpu {
where
S: Serializer,
{
- let mut state = serializer.serialize_struct("Cpu", 1)?;
+ let mut state = serializer.serialize_struct("... | 1 | 5 | 5 |
a5cf3e179f8c10c67282eefab6cd71cfc697e0c1 | Guillaume Gomez | 2023-09-17T15:10:47 | Add command to refresh components | diff --git a/examples/simple.rs b/examples/simple.rs
index 9c4338c..14fec86 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -62,15 +62,19 @@ fn print_help() {
);
writeln!(
&mut io::stdout(),
- "refresh_disks : reloads only disks information"
+ "refresh_components : relo... | 1 | 12 | 3 |
9ee1f2c9d0fd7cd25edeaf12c88aeb8a6e996a01 | Guillaume Gomez | 2023-09-14T20:58:31 | Move unix platforms into the same folder to move the unix files into it as well | diff --git a/src/lib.rs b/src/lib.rs
index 0e98488..f86d9a6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,52 +22,24 @@ cfg_if::cfg_if! {
#[cfg(test)]
pub(crate) const MIN_USERS: usize = 0;
- } else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
- mod apple;
- use apple a... | 47 | 64 | 63 |
0e1ef48a450331be19a66999b220561a2bb09649 | Patrick José Pereira | 2023-09-08T20:31:56 | freebsd: system: Update to use new refresh_cpu_usage
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> | diff --git a/src/freebsd/system.rs b/src/freebsd/system.rs
index bccb6ad..51b4dc0 100644
--- a/src/freebsd/system.rs
+++ b/src/freebsd/system.rs
@@ -118,7 +118,7 @@ impl SystemExt for System {
fn refresh_components_list(&mut self) {
if self.cpus.cpus.is_empty() {
- self.refresh_cpu();
+ ... | 1 | 1 | 1 |
b7aa853724e64bc8c925659f328374866dd38b0a | Patrick José Pereira | 2023-09-08T20:31:42 | c_interface: Update to use new refresh_cpu_usage
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> | diff --git a/src/c_interface.rs b/src/c_interface.rs
index f39e5be..26bb84e 100644
--- a/src/c_interface.rs
+++ b/src/c_interface.rs
@@ -58,7 +58,7 @@ pub extern "C" fn sysinfo_refresh_memory(system: CSystem) {
}
}
-/// Equivalent of [`System::refresh_cpu()`][crate::System#method.refresh_cpu].
+/// Equivalent o... | 1 | 2 | 2 |
830f39403fe31ca1bf181af80932d4f3b1851996 | Patrick José Pereira | 2023-09-03T15:46:12 | lib: Update to use new refresh_cpu_usage
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> | diff --git a/src/lib.rs b/src/lib.rs
index 54b9f0b..0e98488 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -290,7 +290,7 @@ mod test {
}
let mut s = System::new();
for _ in 0..10 {
- s.refresh_cpu();
+ s.refresh_cpu_usage();
// Wait a bit to update CPU usage va... | 1 | 3 | 3 |
cd44cd144855f8c780c707a8aec9f64ba02b066e | Patrick José Pereira | 2023-09-03T13:45:59 | traits: Add refresh_cpu_frequency and move refresh_cpu to update everything"
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> | diff --git a/src/traits.rs b/src/traits.rs
index c41280d..6cc0109 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -746,7 +746,7 @@ pub trait SystemExt: Sized + Debug + Default + Send + Sync {
/// ```
fn refresh_system(&mut self) {
self.refresh_memory();
- self.refresh_cpu();
+ self.re... | 1 | 38 | 3 |
1b0fb8ee89d09667ba8ff04a15cb34fc66fa59b3 | Guillaume Gomez | 2023-09-06T08:54:16 | Update crate version to 0.29.10 | diff --git a/Cargo.lock b/Cargo.lock
index 8908be7..11518b7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,7 +247,7 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.29.9"
+version = "0.29.10"
dependencies = [
"cfg-if",
"core-foundation-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 372e369..0... | 2 | 2 | 2 |
c8fb3a6f18363b8f00a0feaddd74e2761b522b42 | Paul Dagnelie | 2023-09-05T19:00:25 | Fix memory limits to only use cgroups values if they're sensible | diff --git a/src/linux/system.rs b/src/linux/system.rs
index bfd0690..c9c6eb4 100644
--- a/src/linux/system.rs
+++ b/src/linux/system.rs
@@ -9,6 +9,7 @@ use crate::{
};
use libc::{self, c_char, c_int, sysconf, _SC_CLK_TCK, _SC_HOST_NAME_MAX, _SC_PAGESIZE};
+use std::cmp::min;
use std::collections::HashMap;
use st... | 1 | 44 | 43 |
b9536e236d35438b977112722a445c5b40be06c2 | Patrick José Pereira | 2023-09-03T13:47:57 | src: linux: cpu: Add debug in public CpuValues
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com> | diff --git a/src/linux/cpu.rs b/src/linux/cpu.rs
index d99b325..80765c8 100644
--- a/src/linux/cpu.rs
+++ b/src/linux/cpu.rs
@@ -224,7 +224,7 @@ impl CpusWrapper {
}
/// Struct containing values to compute a CPU usage.
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, Debug)]
pub(crate) struct CpuValues {
user: ... | 1 | 1 | 1 |
9f39e4105b7770fa1bd9d6f4fa70836d8fdcc201 | Guillaume Gomez | 2023-08-27T20:55:13 | Update crate version to 0.29.9 | diff --git a/Cargo.lock b/Cargo.lock
index 1f2d6e0..8908be7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,7 +247,7 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.29.8"
+version = "0.29.9"
dependencies = [
"cfg-if",
"core-foundation-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 12c1062..37... | 2 | 2 | 2 |
5410725a10dde633ef403b2f8c885611d95fac27 | Ittai Dafner | 2023-08-27T08:54:53 | Fix cgroups always being ignored when refreshing memory | diff --git a/src/linux/system.rs b/src/linux/system.rs
index 25dd087..bfd0690 100644
--- a/src/linux/system.rs
+++ b/src/linux/system.rs
@@ -597,7 +597,7 @@ impl SystemExt for System {
fn read_u64(filename: &str) -> Option<u64> {
get_all_data(filename, 16_635)
.ok()
- .and_then(|d| u64::from_str(&... | 1 | 1 | 1 |
aa8489e3cd471046bc55cd2d1ccb183b5b40e9a2 | Guillaume Gomez | 2023-08-13T20:42:57 | Update crate version to 0.29.8 | diff --git a/Cargo.lock b/Cargo.lock
index aed83ca..1f2d6e0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,7 +247,7 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.29.7"
+version = "0.29.8"
dependencies = [
"cfg-if",
"core-foundation-sys",
diff --git a/Cargo.toml b/Cargo.toml
index e3e09f1..12... | 2 | 2 | 2 |
a6a0686b8561c1f9d0bc81c84b01b414fa372bc0 | Guillaume Gomez | 2023-08-13T20:25:19 | Add missing `saturating_*` calls | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index 1161386..102a8a6 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -183,9 +183,9 @@ impl ProcessExt for Process {
fn disk_usage(&self) -> DiskUsage {
DiskUsage {
- read_bytes: self.read_bytes ... | 8 | 27 | 21 |
e975bb2b448f827630725973f9cff4b2c0859421 | Guillaume Gomez | 2023-08-13T13:49:16 | Fix check_all_process_uids_resolvable test | diff --git a/src/lib.rs b/src/lib.rs
index 23ad509..54b9f0b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -353,7 +353,9 @@ mod test {
#[test]
fn check_all_process_uids_resolvable() {
- if System::IS_SUPPORTED {
+ // On linux, some user IDs don't have an associated user (no idea why though).
+ ... | 1 | 3 | 1 |
cb0eb4ae2af72bb1d0bd03cb859f741b76192c98 | Guillaume Gomez | 2023-08-13T13:47:41 | Move Debug impl for User into appropriate file | diff --git a/src/common.rs b/src/common.rs
index ea084a2..267ab7e 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -811,16 +811,6 @@ cfg_if::cfg_if! {
}
}
-impl fmt::Debug for User {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("User")
- .field("uid", &self... | 2 | 13 | 11 |
e6cc62ca3599a56d79bfeb1dfc71dfcd18e150b2 | Guillaume Gomez | 2023-08-13T12:23:42 | Implement serde serialization for Group | diff --git a/src/serde.rs b/src/serde.rs
index 2abe54b..02d3978 100644
--- a/src/serde.rs
+++ b/src/serde.rs
@@ -2,7 +2,7 @@
use crate::common::PidExt;
use crate::{
- ComponentExt, CpuExt, DiskExt, DiskKind, DiskUsage, MacAddr, NetworkExt, NetworksExt,
+ ComponentExt, CpuExt, DiskExt, DiskKind, DiskUsage, Gro... | 1 | 15 | 1 |
5696e9602e161692fff792d287b43699650653c9 | Guillaume Gomez | 2023-08-13T12:02:20 | Implement new Group API for Windows | diff --git a/src/windows/users.rs b/src/windows/users.rs
index fa979e7..2c1e5ca 100644
--- a/src/windows/users.rs
+++ b/src/windows/users.rs
@@ -4,7 +4,7 @@ use crate::sys::utils::to_str;
use crate::{
common::{Gid, Uid},
windows::sid::Sid,
- User,
+ Group, User,
};
use std::ptr::null_mut;
@@ -83,7 ... | 1 | 6 | 3 |
43ce6de095a8b66a421e4a827d91a1dbde5c204e | Guillaume Gomez | 2023-08-13T11:46:05 | Implement new Group API for unix targets | diff --git a/src/users.rs b/src/users.rs
index 6d3343b..a7a2263 100644
--- a/src/users.rs
+++ b/src/users.rs
@@ -2,7 +2,7 @@
use crate::{
common::{Gid, Uid},
- User,
+ Group, User,
};
use libc::{getgrgid_r, getgrouplist};
@@ -54,7 +54,7 @@ pub(crate) unsafe fn get_user_groups(
group_id: libc::gid... | 1 | 9 | 3 |
58fb6aa637c8d609639e64be214ee04c3e8fc068 | Guillaume Gomez | 2023-08-13T11:45:50 | Create new `Group` type and new `GroupExt` trait | diff --git a/src/common.rs b/src/common.rs
index 13c3dcf..28b719e 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::{Disk, NetworkData, NetworksExt, UserExt};
+use crate::{Disk, GroupExt, NetworkData, NetworksExt... | 3 | 106 | 14 |
a364977ee89f43b2aacf1d03522f9b87883be5fd | Guillaume Gomez | 2023-08-03T16:52:15 | Fix clippy lint | diff --git a/src/linux/component.rs b/src/linux/component.rs
index 3286829..8aa72e6 100644
--- a/src/linux/component.rs
+++ b/src/linux/component.rs
@@ -248,7 +248,7 @@ impl Component {
let (id, item) = filename.split_once('_')?;
let id = id.get(4..)?.parse::<u32>().ok()?;
- let c... | 1 | 1 | 1 |
9d7fc6cdd0a90cfb834ce554cf66662fbf91fcd1 | Guillaume Gomez | 2023-08-03T10:31:53 | Rename `page_size_kb` into `page_size_b` | diff --git a/src/apple/system.rs b/src/apple/system.rs
index eab30c7..b4eeeda 100644
--- a/src/apple/system.rs
+++ b/src/apple/system.rs
@@ -83,7 +83,7 @@ pub struct System {
mem_available: u64,
swap_total: u64,
swap_free: u64,
- page_size_kb: u64,
+ page_size_b: u64,
#[cfg(not(any(target_os =... | 3 | 8 | 8 |
e62cb1c71137644722d226d3078a1d0be0c31b24 | Guillaume Gomez | 2023-07-29T13:46:31 | Move CPU-related code into cpu.rs file for freebsd | diff --git a/src/freebsd/cpu.rs b/src/freebsd/cpu.rs
index 9d6c8e5..217e4ee 100644
--- a/src/freebsd/cpu.rs
+++ b/src/freebsd/cpu.rs
@@ -1,6 +1,138 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::CpuExt;
+use crate::sys::utils::{
+ get_sys_value_array, get_sys_value_... | 3 | 170 | 141 |
3b88c613dde9912bcdaea62733ebdb8ec52a4f46 | Guillaume Gomez | 2023-07-28T21:56:40 | Fix typo in example output | diff --git a/examples/simple.rs b/examples/simple.rs
index df1d7ee..6dd81b2 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -179,7 +179,7 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
);
writeln!(
&mut io::stdout(),
- "total process ... | 1 | 1 | 1 |
def1ae131f5cce98d43eaceb0cd607d3295a5525 | Guillaume Gomez | 2023-07-28T21:56:32 | Move CPU-related code into `cpu.rs` file | diff --git a/src/apple/cpu.rs b/src/apple/cpu.rs
index ccacbe1..1fe7bc2 100644
--- a/src/apple/cpu.rs
+++ b/src/apple/cpu.rs
@@ -1,14 +1,65 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::sys::system::get_sys_value;
-
+use crate::sys::utils::{get_sys_value, get_sys_valu... | 4 | 115 | 93 |
39f16a84956179a853c7f8c4eaa15df4af12a043 | Guillaume Gomez | 2023-07-28T21:56:17 | Use correct version in Cargo.lock file | diff --git a/Cargo.lock b/Cargo.lock
index 137f952..aed83ca 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,7 +247,7 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.29.6"
+version = "0.29.7"
dependencies = [
"cfg-if",
"core-foundation-sys", | 1 | 1 | 1 |
1054c017048e7445436dc4cb12be54ea1dce283d | Guillaume Gomez | 2023-07-26T19:54:56 | Update crate version to 0.29.7 | diff --git a/Cargo.toml b/Cargo.toml
index cf58624..e3e09f1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.6"
+version = "0.29.7"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
a9a505e88ee58a5000f14e38e05f24bf83b2d6fd | Poliorcetics | 2023-07-26T18:34:46 | Fix: windows process name in 0.29.6 are broken (#1027)
* fix: zero init image name memory to avoid leftoverdata interfering
* fix: ImageName.Length is in bytes, we want the size in wide-chars
* fix: use filename instead of full imagename for process name | diff --git a/src/windows/process.rs b/src/windows/process.rs
index bcdead7..72919a9 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -43,7 +43,7 @@ use winapi::um::errhandlingapi::GetLastError;
use winapi::um::handleapi::CloseHandle;
use winapi::um::heapapi::{GetProcessHeap, HeapAlloc, HeapFree};
... | 1 | 15 | 5 |
9e1e2684a9d78f3e213dfd8f3382628eab6718ab | Jonas Haag | 2023-07-25T15:24:59 | linux/memory: Add cgroups v1 and v2 support (#1024)
linux/memory: Add cgroups v1 and v2 support | diff --git a/examples/simple.rs b/examples/simple.rs
index e93c38c..df1d7ee 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -189,22 +189,27 @@ fn interpret_input(input: &str, sys: &mut System) -> bool {
"memory" => {
writeln!(
&mut io::stdout(),
- "total... | 2 | 85 | 30 |
9b7e79ba7df665ce2ae8b20eddfe4b12a4952d69 | Guillaume Gomez | 2023-07-23T13:09:32 | Get CPU frequency on mac M1 | diff --git a/src/apple/cpu.rs b/src/apple/cpu.rs
index 9eda48d..ccacbe1 100644
--- a/src/apple/cpu.rs
+++ b/src/apple/cpu.rs
@@ -121,18 +121,27 @@ impl CpuExt for Cpu {
}
}
-pub(crate) fn get_cpu_frequency() -> u64 {
+pub(crate) unsafe fn get_cpu_frequency() -> u64 {
let mut speed: u64 = 0;
let mut le... | 6 | 154 | 24 |
ccc1de93b4c00a9966f1b7a56c726450dfe71d99 | Guillaume Gomez | 2023-07-21T21:15:28 | Update crate version to 0.29.6 | diff --git a/Cargo.lock b/Cargo.lock
index 33ff434..137f952 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -247,7 +247,7 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.29.5"
+version = "0.29.6"
dependencies = [
"cfg-if",
"core-foundation-sys",
diff --git a/Cargo.toml b/Cargo.toml
index f0d72a9..cf... | 2 | 2 | 2 |
cc574f06bbfad5a84b02586019946da7aef23635 | Guillaume Gomez | 2023-07-21T21:12:05 | Add comment for windows get_process_name function | diff --git a/src/windows/process.rs b/src/windows/process.rs
index 6de4564..bcdead7 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -279,6 +279,8 @@ unsafe fn display_ntstatus_error(ntstatus: winapi::shared::ntdef::NTSTATUS) {
winapi::um::libloaderapi::FreeLibrary(handler);
}
+// Take a look... | 1 | 2 | 0 |
a38f81321d8f762c71e33719283527167da50979 | Guillaume Gomez | 2023-07-21T16:30:10 | Windows: Get process name using `NtQuerySystemInformation` | diff --git a/src/windows/process.rs b/src/windows/process.rs
index 6ec1d4b..6de4564 100644
--- a/src/windows/process.rs
+++ b/src/windows/process.rs
@@ -24,6 +24,9 @@ use ntapi::ntpebteb::PEB;
use ntapi::ntwow64::{PEB32, PRTL_USER_PROCESS_PARAMETERS32, RTL_USER_PROCESS_PARAMETERS32};
use once_cell::sync::Lazy;
+use... | 2 | 106 | 32 |
b20a44ae50d942fdfc9d6402e5369fcb27fe6021 | Luna Nova | 2023-07-18T16:44:02 | windows/system: refactor main work out of buffer resize loop | diff --git a/src/windows/system.rs b/src/windows/system.rs
index 8b6d4dc..35131ab 100644
--- a/src/windows/system.rs
+++ b/src/windows/system.rs
@@ -228,9 +228,10 @@ impl SystemExt for System {
loop {
let mut cb_needed = 0;
- // reserve(n) ensures the Vec has capacity for n additional... | 1 | 93 | 81 |
95bd5c56390c67172c76bae0e9d44a873eca2205 | Luna Nova | 2023-07-16T21:06:52 | windows/system: use read_unaligned as there is no guarantee entries are aligned | diff --git a/src/windows/system.rs b/src/windows/system.rs
index afa5803..8b6d4dc 100644
--- a/src/windows/system.rs
+++ b/src/windows/system.rs
@@ -18,6 +18,7 @@ use crate::utils::into_iter;
use std::cell::UnsafeCell;
use std::collections::HashMap;
use std::mem::{size_of, zeroed};
+use std::ptr;
use std::time::{Du... | 1 | 3 | 2 |
e639334082f6643b2b23d5cce2520b88bceb26a6 | Luna Nova | 2023-07-16T21:06:19 | windows/system: reserve buffer for both cb_needed 0 and non-zero | diff --git a/src/windows/system.rs b/src/windows/system.rs
index ad7189f..afa5803 100644
--- a/src/windows/system.rs
+++ b/src/windows/system.rs
@@ -227,6 +227,9 @@ impl SystemExt for System {
loop {
let mut cb_needed = 0;
+ // reserve(n) ensures the Vec has capacity for n additional ... | 1 | 3 | 1 |
a3e23bf37f454bb2218e34dea889f917400c813d | Guillaume Gomez | 2023-07-16T14:20:47 | Update crate version to 0.29.5 | diff --git a/Cargo.toml b/Cargo.toml
index 9b9aefe..102f611 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.4"
+version = "0.29.5"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
37ac8601c69a3ac8f875dd547a9eac61db1bab7c | Guillaume Gomez | 2023-07-15T21:46:33 | Add `--generate-link-to-definition` doc option for docs.rs | diff --git a/Cargo.toml b/Cargo.toml
index a4bffc4..9b9aefe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,6 +30,7 @@ features = ["serde"]
default-target = "x86_64-unknown-linux-gnu"
targets = ["i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-unknown-freebsd"... | 1 | 1 | 0 |
4ae1b63796b548d957e088c1abeb810a90437f1b | Guillaume Gomez | 2023-07-15T21:42:10 | Windows: Remove undefined behaviour when retrieving processes | diff --git a/src/windows/system.rs b/src/windows/system.rs
index 849d783..ad7189f 100644
--- a/src/windows/system.rs
+++ b/src/windows/system.rs
@@ -26,7 +26,7 @@ use ntapi::ntexapi::{
use winapi::ctypes::wchar_t;
use winapi::shared::minwindef::{FALSE, TRUE};
use winapi::shared::ntdef::{PVOID, ULONG};
-use winapi::s... | 1 | 93 | 90 |
f0698972cb2b687be2f11a0432c9644dd1b330d7 | Guillaume Gomez | 2023-07-03T17:14:32 | Update crate version to 0.29.4 | diff --git a/Cargo.toml b/Cargo.toml
index 8558128..a4bffc4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.3"
+version = "0.29.4"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
2628c61cc34aac6b13017b7e76262a42740ffd8e | Guillaume Gomez | 2023-07-03T18:03:58 | Fix clippy lint | diff --git a/src/windows/utils.rs b/src/windows/utils.rs
index 9613211..3ed7e21 100644
--- a/src/windows/utils.rs
+++ b/src/windows/utils.rs
@@ -43,7 +43,7 @@ pub(crate) unsafe fn to_str(p: LPWSTR) -> String {
fn utf16_str<S: AsRef<OsStr> + ?Sized>(text: &S) -> Vec<u16> {
OsStr::new(text)
.encode_wide()
... | 1 | 1 | 1 |
1acfe9fd8b6b4af2f7aeb620aebf92af1a13c477 | Guillaume Gomez | 2023-07-03T17:51:28 | Improve code to retrieve network interfaces | diff --git a/src/network.rs b/src/network.rs
index 8cb9477..1aeb4a5 100644
--- a/src/network.rs
+++ b/src/network.rs
@@ -7,11 +7,16 @@ use crate::NetworkData;
/// Interface addresses are OS-independent
pub(crate) fn refresh_networks_addresses(interfaces: &mut HashMap<String, NetworkData>) {
- if let Ok(ifa_itera... | 2 | 41 | 22 |
b7bc547376176ab47777d7c27139f838d2d81bff | Guillaume Gomez | 2023-07-03T17:25:58 | Add "refresh_networks" command in example | diff --git a/examples/simple.rs b/examples/simple.rs
index 44e04f1..e93c38c 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -53,19 +53,23 @@ fn print_help() {
);
writeln!(
&mut io::stdout(),
- "refresh : reloads all processes' information"
+ "refresh : ... | 1 | 13 | 4 |
c2a0820646f3046931b4914e1f1db6fca8a933a6 | Guillaume Gomez | 2023-06-29T18:03:28 | Update crate version to 0.29.3 | diff --git a/Cargo.toml b/Cargo.toml
index 2edd43a..8558128 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.2"
+version = "0.29.3"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
18f3d92085c22cc0c9e8e8bd9abd19c854363d2e | Guillaume Gomez | 2023-06-29T18:02:09 | Improve code examples | diff --git a/src/traits.rs b/src/traits.rs
index 7a261cd..ceaaf3a 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -20,7 +20,8 @@ use std::time::Duration;
/// ```no_run
/// use sysinfo::{DiskExt, System, SystemExt};
///
-/// let s = System::new();
+/// let mut s = System::new();
+/// s.refresh_disks_list();
/// fo... | 1 | 65 | 40 |
2fa03b052e92f4d8ce90e57c548b1732f848dbbd | Guillaume Gomez | 2023-06-07T17:33:50 | Update crate version to 0.29.2 | diff --git a/Cargo.toml b/Cargo.toml
index 2a10a99..2edd43a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.1"
+version = "0.29.2"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
9621aae7b8e1b40dc726f25d0dfb75786cf7ebc8 | Guillaume Gomez | 2023-06-07T17:33:11 | Fix docs.rs platform list | diff --git a/Cargo.toml b/Cargo.toml
index 08fd6d8..2a10a99 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,7 +28,7 @@ unknown-ci = []
features = ["serde"]
# Setting this default target to prevent `freebsd` to be the default one.
default-target = "x86_64-unknown-linux-gnu"
-targets = ["x86_64-unknown-freebsd"]
+targ... | 1 | 1 | 1 |
1e704c6c84d07ae7e776b12cd3e1c5ee0f758668 | Guillaume Gomez | 2023-06-07T11:32:10 | Update crate version to 0.29.1 | diff --git a/Cargo.toml b/Cargo.toml
index 1b72b5e..08fd6d8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.29.0"
+version = "0.29.1"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
c953a3c1cd537174d57309b5a009cef576073940 | Guillaume Gomez | 2023-06-07T10:50:42 | Add users groups display in simple example | diff --git a/examples/simple.rs b/examples/simple.rs
index 364e7d0..44e04f1 100644
--- a/examples/simple.rs
+++ b/examples/simple.rs
@@ -122,7 +122,10 @@ fn print_help() {
&mut io::stdout(),
"frequency : Displays CPU frequency"
);
- writeln!(&mut io::stdout(), "users : Di... | 1 | 10 | 2 |
ecbb8b5cc11558cb86f17a0c7565602e19b18c32 | Guillaume Gomez | 2023-06-07T09:57:06 | Unify macOS code to retrieve users with other OSes | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index db797d7..1161386 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -316,7 +316,7 @@ fn check_if_pid_is_alive(pid: Pid, check_if_alive: bool) -> bool {
return true;
}
// `kill` failed but i... | 4 | 88 | 93 |
458e2bcdd8da927181a8c3757f60c3d258c638bf | Guillaume Gomez | 2023-06-07T09:51:04 | Handle errors correctly when getting group information on linux and freebsd | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index c54e90a..db797d7 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -316,7 +316,7 @@ fn check_if_pid_is_alive(pid: Pid, check_if_alive: bool) -> bool {
return true;
}
// `kill` failed but i... | 5 | 69 | 33 |
feb296705402da82597e420874b2ad031145c27d | Greg Suarez | 2023-06-05T21:17:24 | Use getgrgid_r instead of getgrgid for thread safety | diff --git a/src/users.rs b/src/users.rs
index 08e99c3..0a20fa7 100644
--- a/src/users.rs
+++ b/src/users.rs
@@ -5,7 +5,7 @@ use crate::{
User,
};
-use libc::{getgrgid, getgrouplist};
+use libc::{getgrgid_r, getgrouplist};
use std::fs::File;
use std::io::Read;
@@ -52,12 +52,23 @@ pub fn get_users_list() -> ... | 1 | 15 | 4 |
b30e3d61d6f052563f7841067721897bf4ac2164 | Guillaume Gomez | 2023-06-02T19:05:52 | Update "unknown" for `Disks` type | diff --git a/src/unknown/disk.rs b/src/unknown/disk.rs
index 0d70dbd..cc3d56e 100644
--- a/src/unknown/disk.rs
+++ b/src/unknown/disk.rs
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::{DiskExt, DiskKind};
+use crate::{DiskExt, DiskKind, Disks, DisksExt};
... | 3 | 25 | 17 |
04f4c6f4ccf9c2d5fcc9ad481816eaf3256acb41 | Guillaume Gomez | 2023-06-02T19:02:41 | Update FreeBSD for `Disks` type | diff --git a/src/freebsd/disk.rs b/src/freebsd/disk.rs
index c9f84ee..efcdd6b 100644
--- a/src/freebsd/disk.rs
+++ b/src/freebsd/disk.rs
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::{DiskExt, DiskKind};
+use crate::{DiskExt, DiskKind, Disks, DisksExt};
... | 3 | 28 | 24 |
e4ec20b96688b6dc99f4c69c8277d014d236de8e | Guillaume Gomez | 2023-06-02T18:57:31 | Update macOS for `Disks` type | diff --git a/src/apple/disk.rs b/src/apple/disk.rs
index 0ea492d..a180399 100644
--- a/src/apple/disk.rs
+++ b/src/apple/disk.rs
@@ -4,7 +4,7 @@ use crate::sys::{
ffi,
utils::{self, CFReleaser},
};
-use crate::{DiskExt, DiskKind};
+use crate::{DiskExt, DiskKind, Disks, DisksExt};
use core_foundation_sys::... | 3 | 33 | 28 |
beb2757d05a1e3612dca9453338286faca2e2455 | Guillaume Gomez | 2023-06-02T18:50:59 | Update Windows for `Disks` type | diff --git a/src/windows/disk.rs b/src/windows/disk.rs
index fc7b8af..b68e2b9 100644
--- a/src/windows/disk.rs
+++ b/src/windows/disk.rs
@@ -1,6 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file.
-use crate::{DiskExt, DiskKind};
+use crate::{DiskExt, DiskKind, Disks, DisksExt};
... | 2 | 24 | 20 |
aaf6558ba4b4dd1df940a12043a911fb387ea01d | Guillaume Gomez | 2023-06-02T18:41:16 | Update Linux for `Disks` type | diff --git a/src/linux/disk.rs b/src/linux/disk.rs
index 23871d5..cefbf36 100644
--- a/src/linux/disk.rs
+++ b/src/linux/disk.rs
@@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::sys::utils::{get_all_data, to_cpath};
-use crate::{DiskExt, DiskKind};
+use crat... | 2 | 30 | 26 |
7aa1e9543d74ae9e36b4a1f37943e96c990212ae | Guillaume Gomez | 2023-06-02T19:41:18 | Add FreeBSD target in docs.rs build | diff --git a/Cargo.toml b/Cargo.toml
index a4411a6..1b72b5e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,6 +26,10 @@ unknown-ci = []
[package.metadata.docs.rs]
features = ["serde"]
+# Setting this default target to prevent `freebsd` to be the default one.
+default-target = "x86_64-unknown-linux-gnu"
+targets = [... | 1 | 4 | 0 |
d0c5a5e0bde322b706031d042623173e79d6e564 | Guillaume Gomez | 2023-05-08T12:26:15 | Update libc to 0.2.144 to use new constants | diff --git a/Cargo.toml b/Cargo.toml
index 1ac8d6b..a4411a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -75,7 +75,7 @@ winapi = { version = "0.3.9", features = [
ntapi = "0.4"
[target.'cfg(not(any(target_os = "unknown", target_arch = "wasm32")))'.dependencies]
-libc = "^0.2.112"
+libc = "^0.2.144"
[target.'cfg(a... | 3 | 7 | 14 |
14f9f45858daadf15286bbf5d250c1f390371e70 | Guillaume Gomez | 2023-05-05T20:05:45 | Update crate version to 0.29.0 | diff --git a/Cargo.toml b/Cargo.toml
index 5db3997..1ac8d6b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "sysinfo"
-version = "0.28.4"
+version = "0.29.0"
authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
description = "Library to get system information such as processes, CPUs,... | 1 | 1 | 1 |
c9597c247e6510309ec6ed347d3a098fd81ec156 | Zeeshan Ali Khan | 2023-05-05T13:52:28 | Add a testcase for process credentials | diff --git a/tests/process.rs b/tests/process.rs
index 3a4f916..71aa42c 100644
--- a/tests/process.rs
+++ b/tests/process.rs
@@ -615,3 +615,47 @@ fn test_process_cpu_usage() {
assert!(process.cpu_usage() <= max_usage);
}
}
+
+#[test]
+fn test_process_creds() {
+ use sysinfo::{ProcessExt, System, Syste... | 1 | 44 | 0 |
855990ae4935d9e3ba762e735eabe4700700201c | Zeeshan Ali Khan | 2023-05-04T21:18:19 | API to get effective UID and GID of process | diff --git a/src/apple/app_store/process.rs b/src/apple/app_store/process.rs
index b5de095..d7df72a 100644
--- a/src/apple/app_store/process.rs
+++ b/src/apple/app_store/process.rs
@@ -76,10 +76,18 @@ impl ProcessExt for Process {
None
}
+ fn effective_user_id(&self) -> Option<&Uid> {
+ None
+... | 7 | 131 | 14 |
af4187e02573b7644f18dbd0099337d4a863b696 | Zeeshan Ali Khan | 2023-05-05T13:34:56 | linux: Drop fishy shortcut for getting uid/gid
Getting the UID/GID by looking at the ownership of the relevant /proc
file of a process is strange. The UID/GID are provided in the status
file itself that we read anyway if this method fails. Let's always take
the UID/GID from the process' status file.
This also paves w... | diff --git a/src/linux/process.rs b/src/linux/process.rs
index a8d7c7c..a1c28cf 100644
--- a/src/linux/process.rs
+++ b/src/linux/process.rs
@@ -5,7 +5,6 @@ use std::collections::HashMap;
use std::fmt;
use std::fs::{self, File};
use std::io::Read;
-use std::mem::MaybeUninit;
use std::path::{Path, PathBuf};
use std... | 1 | 0 | 15 |
c7f551fc0d1e1b8c10082a9ab093dad51d5c70a1 | Zeeshan Ali Khan | 2023-05-04T21:20:57 | linux,apple: Fix uid/gid methods to return real IDs
They were returing the effective IDs, which is unexpected and
inconsistent with FreeBSD impl. | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index 8606b25..a7481e6 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -526,8 +526,8 @@ unsafe fn create_new_process(
p.memory = task_info.pti_resident_size;
p.virtual_memory = task_info.pti_virtual_size;
- p... | 2 | 5 | 5 |
08d56ba0b032db51fd89f2b5052a286d7476f9bd | Guillaume Gomez | 2023-05-05T10:01:37 | Correctly handle process status on macOS | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index 8606b25..489e124 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -39,7 +39,7 @@ pub struct Process {
/// enough rights to get this information.
///
/// This is very likely this one that you want instead... | 3 | 45 | 33 |
ce52a425021987224c40891ed8205f28e41c93ab | Guillaume Gomez | 2023-04-30T12:31:14 | Fix clippy warning on Windows | diff --git a/src/windows/network.rs b/src/windows/network.rs
index fb832d4..9ad551f 100644
--- a/src/windows/network.rs
+++ b/src/windows/network.rs
@@ -102,7 +102,7 @@ impl NetworksExt for Networks {
};
match self.interfaces.entry(interface_name) {
hash_map::Entry... | 1 | 1 | 1 |
13745590f5f18aad37c18ced1dff476785315f7b | Guillaume Gomez | 2023-04-30T12:06:11 | Correctly handle EINTR errors on FreeBSD | diff --git a/src/freebsd/network.rs b/src/freebsd/network.rs
index 08a2042..bad2f32 100644
--- a/src/freebsd/network.rs
+++ b/src/freebsd/network.rs
@@ -88,7 +88,7 @@ impl Networks {
let data = &data.ifmd_data;
match self.interfaces.entry(name) {
hash_map::Entry::O... | 3 | 3 | 3 |
0a592cda5b86c6f8408c4406a3530416d33b82bf | Guillaume Gomez | 2023-04-30T11:55:42 | Correctly handle EINTR errors on linux | diff --git a/src/linux/disk.rs b/src/linux/disk.rs
index 1642fd5..23871d5 100644
--- a/src/linux/disk.rs
+++ b/src/linux/disk.rs
@@ -61,7 +61,7 @@ impl DiskExt for Disk {
unsafe {
let mut stat: statvfs = mem::zeroed();
let mount_point_cpath = to_cpath(&self.mount_point);
- ... | 4 | 5 | 5 |
ad02ed7781e686f66e0c3973eb2a6e54ce054dff | Guillaume Gomez | 2023-04-29T19:37:13 | Correctly handle EINTR errors on MacOS | diff --git a/src/apple/macos/process.rs b/src/apple/macos/process.rs
index c243ff5..8606b25 100644
--- a/src/apple/macos/process.rs
+++ b/src/apple/macos/process.rs
@@ -189,7 +189,7 @@ impl ProcessExt for Process {
let mut status = 0;
// attempt waiting
unsafe {
- if libc::waitpid(... | 4 | 37 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.