Skip to content
Commit d890e8b3 authored by Anita Zhang's avatar Anita Zhang Committed by Zbigniew Jędrzejewski-Szmek
Browse files

process-util: don't allocate max length to read /proc/PID/cmdline

Alternative title: Replace get_process_cmdline()'s fopen()/fread() with
read_full_virtual_file().

When RLIMIT_STACK is set to infinity:infinity, _SC_ARG_MAX will
return 4611686018427387903 (depending on the system, but definitely
something larger than most systems have). It's impractical to allocate this
in one go when most cmdlines are much shorter than that.

Instead use read_full_virtual_file() which seems to increase the buffer
depending on the size of the contents.

(cherry picked from commit 7b7a060e)
(cherry picked from commit fca334fb)
parent 7deae040
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment