Re: [systemd-devel] [PATCH] RFC: util: Avoid memory allocations for formatting paths

2013-04-08 Thread Lennart Poettering
On Sat, 06.04.13 10:05, Holger Hans Peter Freyther (hol...@freyther.de) wrote: From: Holger Hans Peter Freyther hol...@moiji-mobile.com Avoid memory allocations to construct the path for files in the procfs. The procfs paths are way shorter than the PATH_MAX so we can use snprintf on a

[systemd-devel] [PATCH] RFC: util: Avoid memory allocations for formatting paths

2013-04-06 Thread Holger Hans Peter Freyther
From: Holger Hans Peter Freyther hol...@moiji-mobile.com Avoid memory allocations to construct the path for files in the procfs. The procfs paths are way shorter than the PATH_MAX so we can use snprintf on a string located on the stack. This shows up as a win on x86 using the benchmark program

[systemd-devel] [PATCH] RFC: util: Avoid memory allocations for formatting paths

2013-04-03 Thread Holger Freyther
From: Holger Hans Peter Freyther hol...@moiji-mobile.com Avoid memory allocations to construct the path for files in the procfs. The procfs paths are way shorter than the PATH_MAX so we can use snprintf on a string located on the stack. This shows up as a win on x86 using the benchmark program

Re: [systemd-devel] [PATCH] RFC: util: Avoid memory allocations for formatting paths

2013-04-03 Thread Lennart Poettering
On Wed, 03.04.13 08:27, Holger Freyther (hol...@freyther.de) wrote: +#define PROCFS_PATH_LEN (sizeof(/proc/)-1 + DECIMAL_STR_MAX(unsigned long)) Even though we use %lu to actually print the PID it's stil in the PID range, so I'd prefer using DECIMAL_STR_MAX(pid_t) here... +#define