summaryrefslogtreecommitdiff
path: root/src/bootchart/bootchart.c
AgeCommit message (Collapse)Author
2014-10-03bootchart: use 'n/a' if PRETTY_NAME is not foundThomas Hindoe Paaboel Andersen
Spotted with coverity. If parsing both /etc/os-release and /usr/lib/os-release fails then null would be passed on. The calls to parse the two files are allowed to fail. A empty /etc may not have had the /etc/os-release symlink restored yet and we just try again in the loop. If for whatever reason that does not happen then we now pass on 'n/a' instead of null.
2014-09-28bootchart: check return of strftimeThomas Hindoe Paaboel Andersen
Found by coverity. Fixes: CID#996314 and #996312
2014-08-11bootchart: it's not OK to return -1 from a main programLennart Poettering
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-08-03bootchart: ask for --rel when failed to initialize graph start timeKarel Zak
We always read system uptime before log start time. So the uptime should be always smaller number, except it includes system suspend time. It seems better to ask for --rel and exit() than try to be smart and try to recovery from this situation or generate huge messy graphs.
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-07-31Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek
In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
2014-07-31Constify option table and add missing optionZbigniew Jędrzejewski-Szmek
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-15Constify ConfigTableItem tablesZbigniew Jędrzejewski-Szmek
2014-06-13os-release: define /usr/lib/os-release as fallback for /etc/os-releaseLennart Poettering
The file should have been in /usr/lib/ in the first place, since it describes the OS container in /usr (and not the configuration in /etc), hence, let's support os-release files in /usr/lib as fallback if no version in /etc exists, following the usual override logic. A prior commit already enabled tmpfiles to create /etc/os-release as a symlink to /usr/lib/os-release should it be missing, thus providing nice compatibility with applications only checking in /etc. While it's probably a good idea if all apps check both locations via a fallback logic, it is only necessary in the early boot process, as long as the /etc/os-release symlink has not been restored, in case we boot with an empty /etc.
2014-04-24bootchart: print to stdout and display default values in helpZbigniew Jędrzejewski-Szmek
2014-04-24bootchart: rewrite usage message more generallyWaLyong Cho
2014-04-24bootchart: add control group optionWaLyong Cho
2014-02-24Remove dead lines in various placesZbigniew Jędrzejewski-Szmek
As pointed-out by clang -Wunreachable-code. No behaviour changes.
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-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-10-14list: make our list macros a bit easier to use by not requring type spec on ↵Lennart Poettering
each invocation We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
2013-10-13Fix write-only use of a few variablesZbigniew Jędrzejewski-Szmek
Since the invention of read-only memory, write-only memory has been considered deprecated. Where appropriate, either make use of the value, or avoid writing it, to make it clear that it is not used.
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-25conf-parser: restrict .include usageLennart Poettering
Disallow recursive .include, and make it unavailable in anything but unit files.
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-17bootchart: Fix errno usage.Auke Kok
2013-04-17Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek
The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
2013-04-15bootchart: put the bootchart into the journal.Auke Kok
This bit of code is mostly stolen from coredump.c. We construct a simple journal message and append the bootchart file in the journal automatically. You can extract the latest bootchart from the current boot with something like: $ journalctl -b MESSAGE_ID=9f26aa562cf440c2b16c773d0479b518 --field=BOOTCHART which prints it to stdout. None of the other logic is touched. The journal entry is created even if bootchart was run manually, which is probably wrong.
2013-04-10Use initalization instead of explicit zeroing in more placesZbigniew Jędrzejewski-Szmek
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-31bootchart: split out option parsing from main()Zbigniew Jędrzejewski-Szmek
2013-03-11bootchart: bump RLIMIT_NOFILE only after we forked us off, so that the init ↵Lennart Poettering
system inherits the kernel default
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-07Revert "bootchart: use _cleanup_close_"Zbigniew Jędrzejewski-Szmek
This reverts commit 0ea9530d401827e299c6e04a433e69a7a2a89d80. attribute(cleanup) can only be used inside functions (*of, sysfd are leaked). Cleanup functions are only called once when exiting scope (*f is leaked twice).
2013-03-07bootchart: use _cleanup_close_Nathaniel Chen
use _cleanup_{close_,fclose_} to close streams and file descriptors
2013-03-07bootchart: document -C, --cmdline parameterHarald Hoyer
2013-03-07bootchart: rename global len to samples_lenHarald Hoyer
2013-03-07bootchart: add parameter "-C" to expand process names to the full cmdlineHarald Hoyer
2013-02-16bootchart: rename --filter to --no-filterZbigniew Jędrzejewski-Szmek
Turning off filtering with --filter is just too confusing. Config option "Filter" doesn't have to be changed, here "Filter=yes" already meant to filter.
2013-02-16bootchart: provide better error messagesZbigniew Jędrzejewski-Szmek
2013-02-16man: move bootchart README to manpage, docbooksifyZbigniew Jędrzejewski-Szmek
2013-02-14bootchart: stricter checks of cli inputThomas Hindoe Paaboel Andersen
2013-02-14bootchart: use conf-parser & CamelCase names in .confThomas Hindoe Paaboel Andersen
2013-02-14bootchart: parse /etc/os-release rather than system-releaseHarald Hoyer
Also parse it early, so that we can get it in the initramfs.
2013-02-14bootchart: more fixes for bootchart in the initramfsHarald Hoyer
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
2013-02-12bootchart: make bootchart work from within the initrdHarald Hoyer
With this patch, bootchart can be started from within the initramfs via the kernel command line "rdinit=/usr/lib/systemd/systemd-bootchart" see: http://harald.fedorapeople.org/downloads/bootchart-20130207-1652.svg
2013-02-12systemd-bootchart: relicense to LGPLv2.1+Auke Kok
When we merged systemd-bootchart we omitted relicensing this to LGPL. Now that code is being used for other purposes we need to make sure the code is shareable within systemd without further problems. The original committers and contributors of bootchart before it was merged all have agreed with the relicensing.
2013-01-14bootchart: no need for memset hereLennart Poettering
2013-01-10bootchart: Convert malloc/memset to callocAuke Kok