summaryrefslogtreecommitdiff
path: root/src/stat.c
AgeCommit message (Collapse)Author
2015-02-27tail,stat: improve support for the IBRIX file systemShane M Seymour
Note that IBRIX used to have a different magic number 0x013111A7 instead of the current 0x013111A8. However, the former is no longer used and the version of IBRIX it was used in is really ancient, so it's extremely unlikely anyone is still using it. Therefore, just add the newer magic number. Mark IBRIX as a 'remote' file system type as inotify support had never been officially tested with it. * src/stat.c (human_fstype): Add file system ID definition. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/19951
2015-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-09-19doc: output correct --help references with --program-prefixPádraig Brady
* src/system.h (emit_ancillary_info): Take the invariant PROGRAM_NAME as a parameter, so that consistent references are made to online docs and texinfo nodes, when a --program-prefix is in place. Note the man pages don't need this fix as they're generated before the program prefix is used. * NEWS: Mention the improvements in references to online documentation.
2014-09-08maint: prefer 'return status;' to 'exit (status);' in 'main'Paul Eggert
* build-aux/gen-single-binary.sh: Don't use ATTRIBUTE_NORETURN for main functions. * src/base64.c, src/basename.c, src/cat.c, src/chcon.c, src/chgrp.c: * src/chmod.c, src/chown.c, src/chroot.c, src/cksum.c, src/comm.c: * src/cp.c, src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/getlimits.c, src/groups.c, src/head.c, src/hostid.c: * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c: * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/make-prime-list.c: * src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mktemp.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/nproc.c: * src/numfmt.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c: * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c: * src/readlink.c, src/realpath.c, src/rm.c, src/rmdir.c, src/runcon.c: * src/seq.c, src/shred.c, src/shuf.c, src/sleep.c, src/sort.c: * src/split.c, src/stat.c, src/stdbuf.c, src/stty.c, src/sum.c: * src/sync.c, src/tac.c, src/tail.c, src/tee.c, src/timeout.c: * src/touch.c, src/tr.c, src/true.c, src/truncate.c, src/tsort.c: * src/tty.c, src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c: * src/uptime.c, src/users.c, src/wc.c, src/who.c, src/whoami.c: In 'main' functions, Prefer 'return status;' to 'exit (status);'. * src/coreutils-arch.c (_single_binary_main_uname) (_single_binary_main_arch): * src/coreutils-dir.c, src/coreutils-vdir.c (_single_binary_main_ls) (_single_binary_main_dir, _single_binary_main_vdir): Omit ATTRIBUTE_NORETURN. Return a value. * src/coreutils.c (SINGLE_BINARY_PROGRAM): Omit ATTRIBUTE_NORETURN. (launch_program): Now static. * src/dd.c (finish_up): New function. (quit, main): Use it. * src/getlimits.c (main): Return a proper exit status. * src/test.c (test_main_return): New macro. (main): Use it. * src/logname.c, src/nohup.c, src/whoami.c: Use 'error' to simplify exit status in 'main' function. * src/yes.c (main): Use 'return' rather than 'error' to exit, so that GCC doesn't suggest ATTRIBUTE_NORETURN.
2014-06-13tail: fix --follow to use polling mode for VXFSPádraig Brady
Veritas File System can run in single instance or clustered mode, so mark as remote to avoid using inotify for the latter case. * src/stat.c (human_fstype): Tag VXFS as remote, to use polling for the clustered variant (VXCFS). * NEWS: Mention the bug fix. Reported by Ondřej Vašík in http://bugzilla.redhat.com/1104244 Fixes http://bugs.gnu.org/17770
2014-06-01stat: avoid redundant stat() callsPádraig Brady
* src/stat.c (find_bind_mount): NAME is invariant in the loop, so only stat(NAME) outside the loop.
2014-05-23stat,tail: improve support for LogFS and ConfigFSPádraig Brady
* src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement.
2014-05-22maint: enforce consistent width and case of file system constantsPádraig Brady
* src/stat.c (human_fstype): Adjust a couple of existing constants to be a consistent width and capitalization so that the src/fs-magic-compare target works without reporting false positives. * cfg.mk (sc_fs-magic-compare): A new syntax check to enforce this. Improved by: Jim Meyering
2014-04-22doc: clarify meaning of stat's mtime and ctime formatsAssaf Gordon
* src/stat.c (usage): s/modification time/data modification time/; s/change time/status change time/ * doc/coreutils.texi: Ditto.
2014-03-18stat: port birthtime to Solaris 11Paul Eggert
Problem reported by Rich Burridge. * src/stat.c [HAVE_GETATTRAT]: Include <attr.h>, <sys/nvpair.h>. (print_statfs, print_stat, print_it): Pass fd, too, for the benefit of get_birthtime. All uses changed. (get_birthtime): New function, for porting to Solaris 11. (print_stat): Use it. * configure.ac (getattrat, LIB_NVPAIR): New checks. * src/local.mk (src_stat_LDADD): Add $(LIB_NVPAIR).
2014-01-29stat,tail: improve support for HFS+ and HFSXPádraig Brady
* src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/16336
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-12-13stat,tail: improve support for hostfs and smackfsPádraig Brady
hostfs is provided by the Linux UML subsystem. smackfs is provided by the Linux Smack security module. * src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement, and adjust for the fact that SNFS is a remote file system.
2013-08-01doc: use semicolon instead of period in option descriptionsBenno Schulenberg
Also do not end option descriptions with a period, properly indent continuation lines, and make some tiny clarifications. * src/du.c (usage): Lowercase after semicolon. * src/ls.c (usage): Semicolons instead of periods, small rephrasing and two hyphens for clarity, proper indentation. * src/mktemp.c (usage): Semicolons and lowercase. * src/od.c (usage): Semicolons. * src/ptx.c (usage): Use the standard phrase, clarify default option. * src/setuidgid.c (usage): Properly indent continuation line. * src/split.c (usage): Semicolons, lowercase, no final period. * src/stat.c (usage): Semicolons, lowercase. * src/tail.c (usage): Proper indentation, one shorter rephrasing, semicolons, no final periods. * src/timeout.c (usage): Properly indent, semicolons, no final periods. Fixes http://bugs.gnu.org/14976
2013-07-02stat: ensure --context emits an "unrecognized option" diagnosticPádraig Brady
* src/stat.c (long_options): Remove the "context" option as it's no longer referenced since commit v8.5-65-g13f3237
2013-05-24stat: tune for large-LDAP casePaul Eggert
* src/stat.c (print_stat): Omit unnecessary calls to setpwent, setgrent. Problem reported by Fridolín Pokorný in <http://bugs.gnu.org/14462>.
2013-04-28stat,tail: improve support for snfsPádraig Brady
The StorNext distributed file system was previously known as CVFS. * src/stat.c (human_fstype): Add new file system ID definition. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/14251
2013-03-24stat,tail: improve support for efivarfs, exofs, f2fs and ubifsPádraig Brady
* src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/14020
2013-03-22doc: clarify stat the meaning of --format="%t %T"Pádraig Brady
* src/stat.c (usage): Mention that the values are only defined for character and block special files. * doc/coreutils.texi (stat invocation): Likewise. Also mention st_rdev. Reported in http://bugs.gnu.org/13927
2013-02-20maint: cleanup up various uses of __attribute__Pádraig Brady
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute() form without trailing underscores as that is not elided where required. Also ensure we use gnulib macros rather than defining our own. * src/system.h: Remove gnulib provided macros. * src/chown-core.c: Likewise. * src/chroot.c: Likewise. * src/copy.c: Likewise. * src/csplit.c: Likewise. * src/dd.c: Likewise. * src/expr.c: Likewise. * src/extent-scan.c: Likewise. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/ptx.c: Likewise. * src/sort.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/system.h: Likewise. * src/tac.c: Likewise. * src/test.c: Likewise. * src/tsort.c: Likewise.
2013-01-23maint: define usage note about mandatory args centrallyBernhard Voelker
Each program with at least one long option which is marked as 'required_argument' and which has also a short option for that option, should print a note about mandatory arguments. Define that well-known note centrally and use it rather than literal printf/fputs, and add it where it was missing. * src/system.h (emit_mandatory_arg_note): Add new function. * src/cp.c (usage): Use it rather than literal printf/fputs. * src/csplit.c, src/cut.c, src/date.c, src/df.c, src/du.c: * src/expand.c, src/fmt.c, src/fold.c, src/head.c, src/install.c: * src/kill.c, src/ln.c, src/ls.c, src/mkdir.c, src/mkfifo.c: * src/mknod.c, src/mv.c, src/nl.c, src/od.c, src/paste.c: * src/pr.c, src/ptx.c, src/shred.c, src/shuf.c, src/sort.c: * src/split.c, src/stdbuf.c, src/tac.c, src/tail.c, src/timeout.c: * src/touch.c, src/truncate.c, src/unexpand.c, src/uniq.c: Likewise. * src/base64.c (usage): Add call of the above new function because at least one long option has a required argument. * src/basename.c, src/chcon.c, src/date.c, src/env.c: * src/nice.c, src/runcon.c, src/seq.c, src/stat.c, src/stty.c: Likewise.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-12-15tail,stat: improve support for the ceph file systemBernhard Voelker
Teach tail -f that it must use polling on ceph file systems, and let stat -f --format=%T report the file system type name, "ceph". Website: http://ceph.com/ * src/stat.c (human_fstype): Add a case: ceph, 0x00C36400, remote. * NEWS (Improvements): Mention it. * THANKS.in: Update. Reported by Konrad Wróblewski in http://bugs.gnu.org/13172.
2012-09-23tail,stat: improve support for vmhgfsJim Meyering
Teach tail -f that it must use polling on vmhgfs file systems, and let stat -f --format=%T report the file system type name, "vmhgfs". * src/stat.c (human_fstype): Add a case: vmhgfs, 0xbacbacbc, remote. * NEWS (Improvements): Mention it. * THANKS.in: Update. Reported by Daniel Tschinder in http://bugs.gnu.org/12461.
2012-09-06tail,stat: add support for VZFSJim Meyering
* src/stat.c (human_fstype): Add a case: vzfs, 0x565A4653 (local). Reported by Jens Rosenboom in http://bugs.gnu.org/12356 * NEWS (Improvement): Mention it.
2012-08-29tail,stat: improve support for ZFSJim Meyering
This change enables tail -f to use inotify and lets stat -f --format=%T report the file system type name, "zfs". * src/stat.c (human_fstype): Add a case: zfs, 0x2fc12fc1. * NEWS (Improvements): Mention it. * THANKS.in: Update. Reported by Raimonds Miltins in http://bugs.gnu.org/12301.
2012-06-30stat,tail: recognize new file system type: aufsJim Meyering
* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new remote file system type: aufs (0x61756673). * NEWS (New features): Mention stat -f. (Bug fixes): Mention it for tail -f. Reported by Michael Mol in http://bugs.gnu.org/11823
2012-06-01stat,tail: recognize new file system type: panfsJim Meyering
* src/stat.c (human_fstype) [__linux__]: Add a 'case' for the new remote file system type: panfs (0xAAD7AAEA). * NEWS (New features): Mention stat -f. (Bug fixes): Mention it for tail -f. Reported by Travis Gummels in http://bugzilla.redhat.com/827199
2012-05-16stat: report the correct block size for file system usagePádraig Brady
struct statfs has the f_frsize member since Linux 2.6, so use that rather than f_bsize which can be different. Note the related df change mentioned in NEWS is handled in gnulib by using statvfs() rather than statfs() on Linux > 2.6.36 (where statvfs doesn't hang) and the same method as stat for Linux 2.6 kernels earlier than that. stat(1) doesn't use statvfs() on GNU/Linux as the f_type member isn't available there. Note the change to not use statvfs() on GNU/Linux was introduced in gnulib commit eda39b8 16-08-2003. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Check for the f_frsize member in the statfs structure. * src/stat.c: Use (struct statfs).f_frsize if available. * NEWS (Bug fixes): Mention this stat fix, and the related df fix coming in the next gnulib update. * THANKS.in: Add Nikolaus. Reported and Tested by Nikolaus Rath
2012-05-10stat,tail: recognize new FS types: bdevfs, inodefs, qnx6Jim Meyering
* src/stat.c (human_fstype) [__linux__]: Add 'case's for these local file system types: bdevfs (0x62646576), inodefs (0x42494E4D), qnx6 (0x68191122). Now that the kernel has a name for S_MAGIC_BINFMTFS, use theirs in place of our S_MAGIC_BINFMT_MISC. * NEWS (New features): Mention it.
2012-05-09stat: don't report negative file size as huge positive numberPaul Eggert
* src/stat.c (print_stat): Use out_int, not out_uint for stat.st_size. * NEWS (Bug fixes): Mention it.
2012-01-20stat: clarify the description of the %o stat formatPádraig Brady
* src/stat.c (usage): Indicate this is a transfer size suggestion, rather than some persistent block size. * doc/coreutils.texi (stat invocation): Likewise.
2012-01-11maint: fix minor whitespace issuesPádraig Brady
The previous commit introduced a couple of spacing issues, luckily one of which caused a test to fail. * src/stat.c (default_format): Add a space so times are aligned. * src/tr.c (string2_extentd): Remove an extraneous space.
2012-01-11maint: adjust formatting of certain continued stringsJim Meyering
Add a rule to ding any source file that has a continued string with a word in the first column of the following line. Those tend to trigger malfunction in tools that try to map an arbitrary line number to an enclosing function name. Of course, very many strings do precisely this, *when they are part of the usage function*. So we exempt the body of each usage function. * src/dircolors.c (main): Separate a long, continued string into two separately-quoted parts. * src/od.c (decode_one_format): Likewise. (decode_one_format, main): Move a space from end of preceding line to the beginning of the continued line. * src/tr.c (unquote, string2_extend, validate): Likewise. * src/seq.c (main): Split in two and use string concatenation. * src/stat.c (default_format): Use a mix of techniques. * cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): New rule. Exempt three files in src: system.h, od.c, printf.c.
2012-01-09maint: src/*.[ch]: convert more `...' to '...'Jim Meyering
Run this (twice): git grep -E -l '`.+'\' src/*.[ch] \ |xargs perl -pi -e 's/`(.+?'\'')/'\''$1/'
2012-01-09maint: src/*.c: change remaining quotes (without embedded spaces)Jim Meyering
Run this (twice): git grep -E -l '`[^ ]+'\' src/*.c \ |xargs perl -pi -e 's/`([^ ]+'\'')/'\''$1/'
2012-01-09maint: adjust quoting: emit '...', not `...' in diagnosticsJim Meyering
* src/csplit.c (parse_repeat_count, extract_regexp): As above. * src/date.c (main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (decode_one_format, main): Likewise. * src/pathchk.c (no_leading_hyphen): Likewise. * src/pr.c (main, getoptarg): Likewise. * src/rm.c (diagnose_leading_hyphen): Likewise. * src/sort.c (key_warnings, incompatible_options, main): Likewise. * src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic. * src/test.c (main): Likewise. * src/touch.c (main): Likewise. * src/tr.c (build_spec_list, validate, append_range): Likewise. * tests/misc/mktemp: This is an unusual case, since the affected string contains only the ` of an `...' string. So we change the long ` to a lone '. * tests/pr/pr-tests: Manual quote adapting fix-up. * tests/ln/hard-to-sym: Likewise. * tests/split/suffix-length: Likewise. * tests/mv/part-fail: Likewise. * tests/misc/chcon: Likewise. * tests/misc/stat-printf: Likewise.
2012-01-07maint: use new emit_try_help in place of equivalent fprintfJim Meyering
Run this command: perl -0777 -pi -e \ 's/fprintf \(stderr, _\("Try `%s --help.*\n.*;/emit_try_help ();/m'\ src/*.c
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-12-26stat,tail: recognize new FS type: pipefsJim Meyering
* src/stat.c (human_fstype) [S_MAGIC_PIPEFS]: New case. * NEWS (Bug fixes): Mention this.
2011-12-24doc: stat: clarify that %t and %T expand to the file system typeJim Meyering
* src/stat.c (usage): Mention "file system type", not just "type" for %t and %T. Do not capitalize the first letter of each description.
2011-12-23tail: with -f, use polling when a file is on an FS of unknown typeJim Meyering
Before, we would use inotify in that case, which would work as long as updates were taking place locally, but not at all when remote. Move hard-coded list of known remote FS types into a more maintainable table in stat.c, alongside the list of FS names and magic numbers. Generate a new is_local_fs_type function. * src/Makefile.am (fs-is-local.h): New rule, generated file. * src/extract-magic: Revamp to parse local/remote keyword after each magic number in src/stat.c's case statements. Accept new --local option. * src/.gitignore: Ignore the generated fs-is-local.h. * src/tail.c [HAVE_INOTIFY]: Include fs-is-local.h. (fremote) [HAVE_INOTIFY]: Use the new function in place of the switch stmt with hard-coded list of FS types. Emit a warning when processing a file on a file system of unknown type. * NEWS (Changes in behavior): Mention it. Suggested by Sven Breuner.
2011-12-22tail,stat: add support for FhGFSJim Meyering
* src/stat.c (human_fstype): Add a case: fhgfs, 0x19830326. * src/tail.c (fremote): Add S_MAGIC_FHGFS. * NEWS (Bug fixes): Update the entry for GPFS to mention FhGFS, too. Reported by Sven Breuner.
2011-12-05maint: sort, stat: remove unused parametersJim Meyering
* src/sort.c (struct thread_args) [is_lo_child]: Remove member. (sortlines): Remove unused parameter, "is_lo_child". Update callers. * src/stat.c (out_epoch_sec): Mark unused parameter. (do_statfs, do_stat): Remove unused parameter, "terse". Update callers.
2011-11-02stat: avoid compilation failure with gnulib's new alignofJim Meyering
* src/stat.c: Include <stdalign.h>, not "alignof.h" for alignof use.
2011-09-08stat: avoid compilation failure on AIX 7.xJim Meyering
* src/stat.c (USE_STATVFS): Adjust definition so that it is enabled also on AIX 7.x systems that provide statvfs64 and no statvfs. [USE_STATVFS && ! STAT_STATVFS && STAT_STATVFS64] (STATFS): Define to statvfs64 in that precise case. * m4/stat-prog.m4 (cu_PREREQ_STAT_PROG): Adjust the condition here to match the new one in stat.c, to keep them in sync. Reported by Bruno Haible. For details, see http://article.gmane.org/gmane.comp.gnu.coreutils.general/1668
2011-07-15build: avoid a st_blksize compile failure on some systemsPádraig Brady
* src/stat.c (print_stat): Use ST_BLKSIZE() rather than accessing st_blksize directly, which is not present on NonStop at least. Reported by Joachim Schmitz.
2011-07-07stat: recognize GPFS as a file system typeJim Meyering
* src/stat.c (human_fstype) [S_MAGIC_GPFS]: Add a case, to handle GPFS_SUPER_MAGIC/0x47504653. Prompted by this discussion: http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/14007 * NEWS (Improvements): Mention it.
2011-06-24stat: recognize MQUEUE and PSTOREFS file systemsPádraig Brady
* src/stat.c (human_fstype): Add magic numbers for PSTOREFS and MQUEUE.
2011-06-13maint: use stat-size module from gnulibJames Youngman
* gnulib: Update to latest. * src/system.h: Definitions of ST_* macros have moved into the gnulib module stat-size (specifically, the header file stat-size.h), so remove them from here. * src/truncate.c: Include stat-size.h. * src/stat.c: Likewise. * src/shred.c: Likewise. * src/ls.c: Likewise. * src/du.c: Likewise. * src/ioblksize.h: New file. Move definition of io_blksize out of system.h so that system.h does not have to include stat-size.h. * src/cat.c: Include ioblksize.h. * src/split.c: Likewise. * src/copy.c: Include both stat-size.h and ioblksize.h. * src/Makefile.am (noinst_HEADERS): Add ioblksize.h.