Skip to contentSkip to conversation

PROC_BLOCK_SIZE in proc_info_read()

DISCUSSION Lev Makhlis 1 participant 1 message Jan 17, 2004

lore
Share & tools
lore
#0 lore raw

proc_info_read() (in fs/proc/base.c) uses this macro to limit the size of a single read:

#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output
routines use some slack for overruns */

It seems to me like it's a legacy from array_read() in 2.2.x and can be safely removed. Besides an outdated assumption about the page size, the value is not passed down to (*proc_read)(), so it cannot guard against any overruns, and serves no useful purpose.
Am I missing anything?

(This is not to be confused with PROC_BLOCK_SIZE in fs/proc/generic.c)

The reason it bothers me is that if you have a process with a really long command line, then /proc/<pid>/cmdline "contains" up to PAGE_SIZE bytes, but sys_read() only returns 3072, and needs to be called repeatedly.