Age | Commit message (Collapse) | Author |
|
|
|
* systemd-bootchart always parses /proc/uptime, although the
information is unnecessary when --rel specified
* use /proc/uptime is overkill, since Linux 2.6.39 we have
clock_gettime(CLOCK_BOOTTIME, ...). The backend on kernel side is
get_monotonic_boottime() in both cases.
* main() uses "if (graph_start <= 0.0)" to detect that /proc is
available.
This is fragile solution as graph_start is always smaller than zero
on all systems after suspend/resume (e.g. laptops), because in this
case the system uptime includes suspend time and uptime is always
greater number than monotonic time. For example right now difference
between uptime and monotonic time is 37 hours on my laptop.
Note that main() calls log_uptime() (to parse /proc/uptime) for each
sample when it believes that /proc is not available. So on my laptop
systemd-boochars spends all live with /proc/uptime parsing +
nanosleep(), try
strace /usr/lib/systemd/systemd-bootchart
to see the never ending loop.
This patch uses access("/proc/vmstat", F_OK) to detect procfs.
|
|
|
|
|
|
|
|
Directly before the changed line there is:
while ((parent->next_ps && parent->pid != ps->ppid))
parent = parent->next_ps;
which looks one element ahead of the list, hence we can rely on parent
being non null here.
If 'parent' were NULL at that while loop already, it would crash as we're
dereferencing 'parent' when checking for next_ps already.
Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
|
|
The function svg_ps_bars() dereferencess NULL pointer in the line
endtime = ps->last->sampledata->sampletime;
because of partially initialized ps_struct (ps->last == NULL).
If some process terminates between scaning /proc directory in the log_sample()
function and reading additional information from /proc/PID/... files,
the files couldn't be read, the loop will be continued and partially
initialized structure returned.
|
|
|
|
"Corporation" was misspelled as "Coproration"
|
|
Instead of storing bootchart sample data in arrays, this patch moves
storage to linked lists so that there is no more limit on samples.
This patch also fixes parsing of /proc/<pid>/smaps in kernels > 3.7.
|
|
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
|
|
If the configured number of samples was close to MAXSAMPLES,
the samples buffer could be overrun:
- by 1, because of off-by-one in the condition (samples > arg_samples_len),
and
- by many in case of an overrun, because the number of samples to
capture was increased, instead of being decreased.
Simplify things by converting to a normal for-loop.
In store.c: change buffer size from 4095 to 4096. 4095 is a strange
number.
|
|
systemd-199/src/bootchart/store.c:289: buffer_size_warning: Calling
strncpy with a maximum size argument of 256 bytes on destination array
"ps->name" of size 256 bytes might leave the destination string
unterminated.
...and indeed, the string was used as NULL-terminated later on.
pid_cmdline_strncpy is renamed to pid_cmdline_strscpy to commemorate
the fact that it *does* properly terminate the string.
|
|
Let's update bootchar to share the coding style a bit more with the rest
of the package.
- Some tabs/spaces fixes
- add #pragma to header
- split up header so that we have a 1:1 relation between .c and .h files
like everywhere else
- Prefix user command line arguments/configuration settings with "arg_".
- other coding style fixes
|
|
|