Skip to content

port / wrap / package psutil for rust #6808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
graydon opened this issue May 29, 2013 · 13 comments
Closed

port / wrap / package psutil for rust #6808

graydon opened this issue May 29, 2013 · 13 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@graydon
Copy link
Contributor

graydon commented May 29, 2013

https://code.google.com/p/psutil/ is a very tidy collection of generic operating system and process monitoring interfaces, with supporting C code for all our tier-1 platforms. I would very much like to see this ported or exposed-and-wrapped in std::os.

@emberian
Copy link
Member

I can take this on. psutil is a nice library but deeply integrated with python. I think it'd be worth separating the important platform bits into their own library which is wrapped by rust.

@emberian
Copy link
Member

emberian commented Jun 1, 2013

So psutil is entirely unsuitable as a library. It is deeply tied into Python and only exports Python data structures. Its organization is unideal for direct adaptation to standalone usage.

But there is libstatgrab which is a much better option. It is, however, LGPL. I've contacted the authors to see if it could be relicensed or an exception made.

@graydon
Copy link
Contributor Author

graydon commented Jun 1, 2013

I meant the platform specific parts for reading the info, not the parts that form python values.

@emberian
Copy link
Member

emberian commented Jun 1, 2013

The platform specific parts only feed into python values, there's no separation or cross-platform non-python data structures or anything

@emberian
Copy link
Member

Status: investigated libstatgrab as an alternative, but it is LGPL which is unsuitable for inclusion into the standard library. Seems there are no other good libraries, so writing one would be necessary. I'll get to it... eventually, probably after rustdoc, but if someone else wants to do it before that's fine.

It'd be best to write a liberally-licensed, robust cross-platform C library that does this, to benefit everyone, and write a Rust wrapper on top.

@catamorphism
Copy link
Contributor

(bug triage) Still would be nice, not a milestone blocker.

@nibrahim
Copy link
Contributor

I'd like to give this a shot. It seems like something small enough for me to work on as well as to contribute something useful. My plan is to first write a little non copyleft C library that does the same work as the one in psutil but without the Python bindings. I'll make it work fine as a C library. After that, I'll write a rust wrapper for this. I do my work on Debian so I'll make the Linux version first as a proof of concept and work from there.

Does this sound like a proper plan?

@emberian
Copy link
Member

@nibrahim that'd be great!

@nibrahim
Copy link
Contributor

Well, I'll give it a shot. Gotta start somewhere. :)

@nibrahim
Copy link
Contributor

I got tied up but have made some small progress in writing the C parts. If someone has the time to look and offer comments, I'd value them. My C is far from production quality - https://github.com/nibrahim/cpslib

@nham
Copy link
Contributor

nham commented Aug 11, 2014

Triage bump.

@brson
Copy link
Contributor

brson commented Jan 13, 2015

I think this is not suitable for in-tree. Somebody should build this in Cargo.

@brson brson closed this as completed Jan 13, 2015
@nibrahim
Copy link
Contributor

Can you elaborate a little? What do you mean by build this in cargo?

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 27, 2021
…FN_with_large_array, r=Manishearth

Fix FN in `iter_cloned_collect` with a large array

fixes rust-lang#6808
changelog: Fix FN in `iter_cloned_collect` with a large array

I spotted that [is_iterable_array](https://github.com/rust-lang/rust-clippy/blob/a362a4d1d0edb66aef186c1d27b28c60573078f4/clippy_lints/src/loops/explicit_iter_loop.rs#L67-L75) function that `explicit_iter_loop` lint is using only works for array sizes <= 32.
There is this comment:
> IntoIterator is currently only implemented for array sizes <= 32 in rustc

I'm a bit confused, because I read that [IntoIterator for arrays](https://doc.rust-lang.org/src/core/array/mod.rs.html#194-201) with const generic `N` is stable since = "1.0.0". Although Const Generics MVP were stabilized in Rust 1.51.

Should I set MSRV for the current change? I will try to test with older compilers soon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

6 participants