summaryrefslogtreecommitdiff
path: root/src/bootchart/store.c
AgeCommit message (Collapse)Author
2014-08-18bootchart: use NSEC_PER_SECRonny Chevalier
2014-08-03bootchart: don't parse /proc/uptime, use CLOCK_BOOTTIMEKarel Zak
* 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.
2014-04-24bootchart: add control group optionWaLyong Cho
2014-02-13everywhere: always use O_CLOEXEC where it makes senseLennart Poettering
2014-02-13everywhere: make use of new0() and macro() macros, and stop using perror()Lennart Poettering
2013-12-30bootchart: Remove unneeded check for NULLStefan Beller
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>
2013-10-15Fix for SIGSEGV in systemd-bootchart on short-living processesIgor Zhbanov
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.
2013-08-14bootchart: remove +x permissions on .c fileZbigniew Jędrzejewski-Szmek
2013-06-12bootchart: fix typos in copyright noticesJason St. John
"Corporation" was misspelled as "Coproration"
2013-05-02Dynamically allocate bootchart logsNathaniel Chen
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.
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-03-31bootchart: fix a potential buffer overrunZbigniew Jędrzejewski-Szmek
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.
2013-03-28bootchart: properly terminate stringZbigniew Jędrzejewski-Szmek
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.
2013-03-11bootchart: various superficial cleanupsLennart Poettering
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
2013-03-11bootchart: rename log.c to store.c to aovid confusion with src/shared/log.cLennart Poettering