summaryrefslogtreecommitdiffstats
path: root/misc-utils/fincore.c
Commit message (Collapse)AuthorAgeFilesLines
* fincore: remove unused variable [clang scan]Karel Zak2019-05-161-6/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: use scols_column_set_json_type()Karel Zak2018-04-181-1/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: Handle large files on 32 bit without LFSTobias Stoeckmann2018-02-261-3/+2Star
| | | | | | | | | | | | | | | | | | | If util-linux is installed on a system without large file support, an out of memory issue can occur while processing a file which is 2 GB in size: $ ./configure --disable-largefile && make $ dd if=/dev/zero of=2gb-file seek=2147483646 count=1 bs=1 $ fincore 2gb-file (endless loop) fincore: failed to do mmap: 2gb-file: Cannot allocate memory Even though iterating with "len" seems counter-intuitive, it fixes this issue. The variable len is only in the last iteration not a multiplication of pagesize -- which is the requirement for mmap. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* fincore: Handle large files correctly on 32 bitTobias Stoeckmann2018-02-261-2/+2
| | | | | | | | | | | | | | | | | | If a file is larger than 4 GB on a 32 bit system with large file support (default), it can happen that not all pages are properly processed. This happens due to an int truncation (off_t vs size_t). You can reproduce this on 32 bit with these commands: $ dd if=/dev/zero of=4gb-file seek=4294967295 count=1 bs=1 $ fincore 4gb-file fincore: failed to do mmap: 4gb-file: Invalid argument If a file is larger than 4 GB, the first few pages of a file won't be properly processed. "len" will be smaller than window_size, but the for-loop iterates "window_size" bytes, skipping some pages. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
* fincore: make sure mmap(NULL, ...) [coverity scan]Karel Zak2017-10-121-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: consolidate usage() "Available columns"Karel Zak2017-06-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix minor typosYuri Chornoivan2017-05-231-2/+2
|
* misc: consolidate smartcols error messagesKarel Zak2017-05-181-3/+3
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: check rc from smartcols stuff [coverity scan]Karel Zak2017-05-171-4/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: fix file descriptor leakSami Kerola2017-04-101-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fincore: use size_t everywhereKarel Zak2017-04-061-3/+3
| | | | | | | It seems better to avoid "int" at all from sizes calculations to make the code more robust for future changes. Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: fix multiplication overflowRuediger Meier2017-04-061-1/+1
| | | | | | This failed on ppc64 with page size 64k. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fincore: add column RESKarel Zak2017-03-271-2/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: fix error on open()Karel Zak2017-03-231-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: add --raw and --jsonKarel Zak2017-03-231-2/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: add --outputKarel Zak2017-03-231-4/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: add --bytes and --noheadingsKarel Zak2017-03-231-19/+31
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: use libsmartcolsKarel Zak2017-03-231-24/+150
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: cleanup return codesKarel Zak2017-03-231-24/+22Star
| | | | | | Don't use EXIT_* macros as functions return code. Signed-off-by: Karel Zak <kzak@redhat.com>
* fincore: new command for counting pages of file contents in coreMasatake YAMATO2017-03-231-0/+209
Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>