You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two problems in `lispids` function realization, both related
to buffer expansion via [Vec#set_len](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.set_len).
* Sometimes `proc_listpids` returns more than `MAXPIDS` (1024)
processes. In this case we could expand the pids vector to the
memory we do not own.
* We used the `Vec#set_len` method with buffer size, whereas it
accepts _items count_. That's why there could be trailing zeros in the result (see
https://github.com/andrewdavidmackenzie/libproc-rs/pull/3/files/e7d2319eb6369e7cd5c7c983caa643441206f104#r94556438).
This change
* Sets `MAXPIDS` variable to the actual kernel-defined maximum number
of PIDs
* Renames `MAXPIDS` constant to `PID_MAX` to reflect kernel's naming.
* Corrects listpid's `Vec#set_len` invocation to receive items count instead of
buffer size.
* Removes redundant "unpadding" behavior.
0 commit comments