aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/stat
Commit message (Collapse)AuthorAgeFilesLines
* Unbreak the tests after r347002.Edward Tomasz Napierala2019-05-011-0/+2
| | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=347003
* Add 'Birth' to 'stat -x' output. Current Linux stat(1)Edward Tomasz Napierala2019-05-011-1/+2
| | | | | | | | | | | | also includes that. Reviewed by: cem MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20130 Notes: svn path=/head/; revision=347002
* stat(1): cache id->name resolutionConrad Meyer2018-08-111-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When invoked on a large list of files, it is most common for a small number of uids/gids to own most of the results. Like ls(1), use pwcache(3) to avoid repeatedly looking up the same IDs. Example microbenchmark and non-scientific results: $ time (find /usr/src -type f -print0 | xargs -0 stat >/dev/null) BEFORE: 3.62s user 5.23s system 102% cpu 8.655 total 3.47s user 5.38s system 102% cpu 8.647 total AFTER: 1.23s user 1.81s system 108% cpu 2.810 total 1.43s user 1.54s system 107% cpu 2.754 total Does this microbenchmark have any real-world significance? Until a use case is demonstrated otherwise, I doubt it. Ordinarily I would be resistant to optimizing pointless microbenchmarks in base utilities (e.g., recent totally gratuitous changes to yes(1)). However, the pwcache(3) APIs actually simplify stat(1) logic ever so slightly compared to the raw APIs they wrap, so I think this is at worst harmless. PR: 230491 Reported by: Thomas Hurst <tom AT hur.st> Discussed with: gad@ Notes: svn path=/head/; revision=337600
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. No functional change intended. Notes: svn path=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+11
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Add HAS_TESTS to all Makefiles that use the SUBDIR.${MK_TESTS}+= tests idiomEnji Cooper2017-08-021-0/+1
| | | | Notes: svn path=/projects/make-check-sandbox/; revision=321911
* :l_flag:: be more aggressive when normalizing whitespaceEnji Cooper2017-07-061-2/+11
| | | | | | | | | | | | | | | Save output from ls -ldT and stat -l, then normalize all repeating whitespace using sed to single column spaces. This makes the test flexible with single-digit days, etc, similar to r320723. This approach is just a bit more of a hammer approach because of how the columns are ordered/spaced in both ls and stat. MFC after: 1 week MFC with: r319841 Notes: svn path=/head/; revision=320724
* Use %e instead of %d with x_output_date(..)Enji Cooper2017-07-061-1/+1
| | | | | | | | | | stat -x doesn't 0-fill days so %d is inappropriate. %e is correct. MFC after: 1 week MFC with: r319841 Notes: svn path=/head/; revision=320723
* Add initial tests for stat(1)Enji Cooper2017-06-122-0/+236
| | | | | | | | | | | | | Testcases for -H, -L, and -f haven't been implemented yet, in part due to additional complexity needed to validate the features: * -H and -f will require an external "helper" program to display/modify the state/permissions for a given path. * -L is being covered partially via the -n testcase today. MFC after: 1 month Notes: svn path=/head/; revision=319841
* stat(1): sort flags in the DESCRIPTION sectionEnji Cooper2017-06-111-4/+4
| | | | | | | | | | -x's description should come after -t's description. MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319836
* Write up some basic tests for readlink(1)Enji Cooper2017-06-114-1/+83
| | | | | | | | | | The tests exercise -f (f_flag), -n (n_flag), and no arguments (basic). MFC after: 1 month Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=319834
* Use MIN() instead of MAX() as the previous syntax was wrote in a weird andMarcelo Araujo2016-04-261-1/+1
| | | | | | | | | | confused way: "prec > 9 ? 9 : prec". Submitted by: pfg, ngie and luke <luke.tw@gmail.com> MFC after: 2 weeks. Notes: svn path=/head/; revision=298599
* Use macro MAX() from sys/param.h.Marcelo Araujo2016-04-221-1/+1
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=298443
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge head from 7/28Simon J. Gerraty2014-08-192-20/+24
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=270164
| * Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * Merge from headSimon J. Gerraty2014-05-082-5/+44
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265720
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync from headSimon J. Gerraty2012-11-041-2/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=242545
| * | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | use .Mt to mark up email addresses consistently (part3)Baptiste Daroussin2014-06-231-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de> Notes: svn path=/head/; revision=267773
* | | | Minor fixes to previous change introducing switch -H, as per commentsThomas Quinot2014-05-112-16/+22
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | on -arch. Reviewed by: gleb Notes: svn path=/head/; revision=265893
* | | Introduce a new command line switch '-H' for stat(1)Thomas Quinot2014-05-072-5/+44
| |/ |/| | | | | | | | | | | | | | | | | causing arguments to be interpreted as NFS file handles. Reviewed by: -arch (jhb, eadler) MFC after: 1 month Notes: svn path=/head/; revision=265591
* | More -Wmissing-variable-declarations fixes.Ed Schouten2012-10-191-2/+2
|/ | | | | | | | | | | | | | | | | | | In addition to adding `static' where possible: - bin/date: Move `retval' into extern.h to make it visible to date.c. - bin/ed: Move globally used variables into ed.h. - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings. - usr.bin/calendar: Remove unneeded variables. - usr.bin/chat: Make `line' local instead of global. - usr.bin/elfdump: Comment out unneeded function. - usr.bin/rlogin: Use _Noreturn instead of __dead2. - usr.bin/tset: Pull `Ospeed' into extern.h. - usr.sbin/mfiutil: Put global variables in mfiutil.h. - usr.sbin/pkg: Remove unused `os_corres'. - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'. Notes: svn path=/head/; revision=241737
* Remove duplicate -l description.Christian Brueffer2012-04-221-5/+1
| | | | | | | | Submitted by: Rainer Hurling <rhurlin@gwdg.de> MFC after: 1 week Notes: svn path=/head/; revision=234577
* Synthesize the change from NetBSD's 1.33:Doug Barton2011-02-111-1/+5
| | | | | | | | | | "Do not crash if a date cannot be represented (localtime returning NULL), use the Epoch value instead." Obtained from: njoly@NetBSD.org Notes: svn path=/head/; revision=218535
* Bring in the relevant changes from NetBSD's 1.31:Doug Barton2010-12-181-3/+3
| | | | | | | | | | | | "Use strlcpy, not strncpy, when the desired semantics are strlcpy's rather than strncpy's." Note: NetBSD's 1.32 is their adoption of our r216206 Obtained from: dholland@NetBSD.org Notes: svn path=/head/; revision=216512
* Bring in the change from OpenBSD's 1.14:Doug Barton2010-12-091-2/+4
| | | | | | | | | | | | | "synchronize synopsis and usage; "-l", "-r", "-s" and "-x" are mutually exclusive; while here, slightly improve spacing in the source code so it fits on a 80-column display again. diff greatly improved by martynas@" Obtained from: sobrado@OpenBSD.org Notes: svn path=/head/; revision=216343
* Bring in the change from NetBSD 1.28:Doug Barton2010-12-051-3/+3
| | | | | | | | | | | "\\ -> \e" Obtained from: joerg@NetBSD.org Bump .Dd because we're now up to date with the latest NetBSD version Notes: svn path=/head/; revision=216219
* Bring in the following changes from NetBSD:Doug Barton2010-12-051-13/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.21 "Document the flags displayed by the default format, and mention their short names. From espie@openbsd via jmc@openbsd." 1.24 "Fix three variable names. From Todd T. Fries via Jason McIntyre." Obtained from: wiz@NetBSD.org (previous 2) 1.25 "Be consistent: document the birthtime field of struct stat for the "B" field specifier." Obtained from: reed@NetBSD.org 1.26 "Drop trailing space." Obtained from: wiz@NetBSD.org 1.27 "Since we have st_birthtime in struct stat, it is in default display." Obtained from: enami@NetBSD.org Purposely skipping the following revisions: 1.22 NetBSD-specific change 1.23 Removal of license clauses 3 and 4, already handled by imp in our r203971 Notes: svn path=/head/; revision=216218
* Bring in the change from NetBSD 1.20:Doug Barton2010-12-051-2/+2
| | | | | | | | | "Make sentence easier to parse. From jsing@openbsd via jmc@openbsd." Obtained from: wiz@NetBSD.org Notes: svn path=/head/; revision=216216
* Bring in the changes from NetBSD 1.16 that we did not already have.Doug Barton2010-12-051-2/+2
| | | | | | | | | "Some fixes from jmc@openbsd." Obtained from: wiz@NetBSD.org Notes: svn path=/head/; revision=216215
* Bring in the changes from NetBSD 1.13 that we did not already have, withDoug Barton2010-12-051-4/+9
| | | | | | | | | | | some differences. "Sort options. Use more mdoc macros. Some nit fixes. Bump date." Obtained from: wiz@NetBSD.org Notes: svn path=/head/; revision=216213
* Bring in the change from NetBSD 1.12:Doug Barton2010-12-051-0/+7
| | | | | | | | | "document default format." Obtained from: yamt@NetBSD.org Notes: svn path=/head/; revision=216209
* Bring in the following changes from NetBSD. See the discussion at:Doug Barton2010-12-051-7/+10
| | | | | | | | | | | | | | | | http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44128 1.29 "Don't printf time_t with %d; fixes PR 44128 from yamt. With this change it successfully prints mtimes after 2038." 1.30 "Improve previous with comments." Obtained from: dholland@NetBSD.org (both) Notes: svn path=/head/; revision=216207
* Fix an "unused variable" error that gets us all the way to WARNS=6Doug Barton2010-12-052-4/+3
| | | | Notes: svn path=/head/; revision=216206
* Bring in the update from NetBSD 1.28:Doug Barton2010-12-051-25/+26
| | | | | | | | | | | | "Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)" Because of code differences I had to hand-apply parts of the patch, so responsibility for errors goes to me. Obtained from: lukem@NetBSD.org Notes: svn path=/head/; revision=216205
* Bring in the update from NetBSD 1.19, the documentation of readlink -fDoug Barton2010-12-051-4/+17
| | | | | | | | | | | | | "PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't grok -f, and there's no alternative (+fix) Patch applied with minor tweak (%y -> %R, as it was already taken) plus some nits from myself. Thanks!" Obtained from: elad@NetBSD.org Notes: svn path=/head/; revision=216204
* Bring in a new feature, adding a -f option to readlink to print the pathDoug Barton2010-12-051-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of the target, similar to realpath(1). See the discussion at: http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=34662 This brings in the following changes: 1.24 "PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't grok -f, and there's no alternative (+fix) Patch applied with minor tweak (%y -> %R, as it was already taken) plus some nits from myself. Thanks!" Obtained from: elad@NetBSD.org 1.25 "Fix a segfault when doing 'stat -f %R' on the stdin file handle, instead fake the filename '(stdin)' like the %N format." Obtained from: mlelstv@NetBSD.org 1.27 "The ofmt variable is actually a bit mask (not the character that was in the format string) so that we can "or" it with the bits in the formats variable. This fixes the missing " -> " in front of the real path (when you use %SR). Also, the ?: needs another space." Obtained from: atatat@NetBSD.org I am purposely omitting the following changes: 1.23 A humanize_number(3) clone that should better be implemented by actually using humanize_number(3) 1.26 This is the removal of license clause 3 and 4, already handled by imp in r203971 Notes: svn path=/head/; revision=216203
* Bring in the change from NetBSD 1.22:Doug Barton2010-12-051-3/+3
| | | | | | | | | | | | | | | | "Fix a trivial truncation case, and eliminate a corner case that might print a nul character." I am purposely bypassing the following versions: 1.19 A build infrastructure change that does not apply to us 1.20 A feature I am not interested in, but don't object if someone else wants to pick it up 1.21 A build infrastructure change that does not apply to us Obtained from: atatat@NetBSD.org Notes: svn path=/head/; revision=216202
* Add my own documentation for the change in our r216196, aka NetBSD's 1.18Doug Barton2010-12-051-0/+4
| | | | | | | | | For -L if stat(2) fails, fall back to lstat(2). .Dd purposely not bumped because more changes are coming. Notes: svn path=/head/; revision=216197
* Bring in the change from NetBSD 1.18:Doug Barton2010-12-051-3/+13
| | | | | | | | | | | | | "If using stat (the -L flag) and it fails, fall back to lstat(). It may be the case that we're examining a broken symlink, and anything is better than nothing." The changes in 1.14 through 1.17 were not relevant to us. Obtained from: atatat@NetBSD.org Notes: svn path=/head/; revision=216196
* stat: Allow -f %Sf to display the file flags symbolically.Jilles Tjoelker2010-04-242-3/+33
| | | | | | | | | | | | I have changed the patch slightly to show '-' if there are no flags just like ls -ldo does. PR: 124349 Submitted by: Ighighi MFC after: 1 week Notes: svn path=/head/; revision=207153
* The NetBSD Foundation has granted permission to remove clause 3 and 4Warner Losh2010-02-162-14/+0
| | | | | | | | | from their software. Obtained from: NetBSD Notes: svn path=/head/; revision=203971
* Let stat(1) use fdevname(3).Ed Schouten2009-02-111-12/+20
| | | | | | | | | | | | | | | | | Because we now have a reliable library function that converts file descriptors to character device names, let stat(1) use this. This means it can now do the following: $ stat -f %N /dev/pts/0 I've changed main() to set file properly, so output() is never called with file set to NULL. Approved by: dougb (older version, still used devname) Notes: svn path=/head/; revision=188498
* o Print an octal representation of suid, sgid and sticky bits with -x flag.Maxim Konovalov2009-02-111-1/+1
| | | | | | | | | | PR: bin/131569 Submitted by: Jaakko Heinonen Reported by: Yannick Cadin MFC after: 1 week Notes: svn path=/head/; revision=188481