summaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* passwd: Cache the user/group tablesTavian Barnes2020-02-291-22/+7
| | | | | | | | | | | | | | | | | | | | | | This is a significant optimization for conditions that need these tables: Benchmark #1: ./bfs ~/code/linux -nouser >/dev/null Time (mean ± σ): 232.0 ms ± 2.5 ms [User: 44.3 ms, System: 185.0 ms] Range (min … max): 228.7 ms … 238.7 ms 12 runs Benchmark #2: ./bfs-1.6 ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.050 s ± 0.012 s [User: 544.2 ms, System: 500.0 ms] Range (min … max): 1.025 s … 1.063 s 10 runs Benchmark #3: find ~/code/linux -nouser >/dev/null Time (mean ± σ): 1.040 s ± 0.012 s [User: 533.6 ms, System: 500.6 ms] Range (min … max): 1.017 s … 1.054 s 10 runs Summary './bfs ~/code/linux -nouser >/dev/null' ran 4.48 ± 0.07 times faster than 'find ~/code/linux -nouser >/dev/null' 4.52 ± 0.07 times faster than './bfs-1.6 ~/code/linux -nouser >/dev/null'
* eval: Irregular files aren't emptyTavian Barnes2020-02-141-1/+1
| | | | | GNU find's -empty returns false for devices, sockets, etc., even though their st_size is 0. Match that behaviour.
* time: Split out time-related functions from utilTavian Barnes2020-02-131-0/+1
|
* Update copyright datesTavian Barnes2020-01-071-1/+1
|
* eval: For -ls, print a + if a file has ACLsTavian Barnes2020-01-071-1/+2
|
* darray: New dynamic array libraryTavian Barnes2019-08-291-1/+2
|
* Make -mount and -xdev do different thingsTavian Barnes2019-07-041-0/+1
| | | | | | | | | POSIX now says -mount should skip the whole mount point, while -xdev should only skip its descendents. C.f. http://austingroupbugs.net/view.php?id=1133 C.f. https://savannah.gnu.org/bugs/?42318 C.f. https://savannah.gnu.org/bugs/?54745
* bftw: Remove BFTW_SKIP_SIBLINGSTavian Barnes2019-06-251-7/+6
| | | | | It's not used by bfs, and it's difficult to support in all search strategies.
* util: Filter out . and .. in xreaddir()Tavian Barnes2019-06-251-25/+8
|
* eval: Get rid of a level of indirection for quitTavian Barnes2019-06-161-13/+10
|
* Implement an iterative deepening mode (-ids)Tavian Barnes2019-05-291-1/+2
|
* Implement a depth-first mode (-dfs)Tavian Barnes2019-05-281-1/+14
|
* bftw: Visit multiple roots breadth-firstTavian Barnes2019-05-281-36/+33
| | | | This makes `bfs a b` treat `a` and `b` as siblings.
* Implement -xattr predicateTavian Barnes2019-05-241-0/+13
|
* fsade: Refactor the POSIX.1e abstractionsTavian Barnes2019-05-241-3/+15
| | | | | | | Since we're going to want to abstract more things that aren't part of POSIX.1e (like xattrs) in a similar way, let's give this a more generic name. And while we're at it, give it some more precise error reporting, and add some tests.
* color: Don't stat() if we don't need toTavian Barnes2019-05-051-7/+1
|
* bftw: Pass a const struct BFTW * to the callbackTavian Barnes2019-05-051-12/+12
|
* bftw: Add a caching stat() API to struct BFTWTavian Barnes2019-05-041-134/+75
|
* stat: Unify the flags argumentsTavian Barnes2019-05-041-16/+12
|
* Release 1.41.4Tavian Barnes2019-04-151-1/+1
|
* eval: Fix -unique with -depthTavian Barnes2019-03-071-1/+1
|
* bftw: Work around d_type being wrong for bind mounts on LinuxTavian Barnes2019-03-061-7/+14
| | | | | | C.f. https://savannah.gnu.org/bugs/?54913 C.f. https://lkml.org/lkml/2019/2/11/2027 Fixes https://github.com/tavianator/bfs/issues/37
* bftw: Switch from taking separate parameters to a parameters structTavian Barnes2019-03-061-6/+18
|
* parse: Use a trie to hold currently open filesTavian Barnes2019-03-061-4/+2
|
* trie: Revamp the API to support mappingsTavian Barnes2019-03-041-5/+8
|
* Implement -uniqueTavian Barnes2019-03-011-0/+43
| | | | Closes #48
* Add some documentation commentsTavian Barnes2019-02-091-0/+4
|
* Fix -nouser/-nogroup error handlingTavian Barnes2019-02-061-2/+20
| | | | | | | | | | The proper way to check for nonexistent users/groups is to set errno to 0 before the get{grg,pwu}id() call, and check it afterwards. On doing this, it becomes obvious that the call can fail if bftw() is using all the available FDs, so give them some ephemeral FDs. It would be ideal to read the user/group table only once, but this fixes the bug for now.
* eval: Fix wrong colors in error messagesTavian Barnes2019-02-011-45/+72
| | | | | When reporting an error, we should try to stat the file first so the message can have the right colors.
* parse: Allow multiple comma-separated debug flagsTavian Barnes2019-01-111-8/+10
|
* posix1e: Split out ACL and capability handling from utilTavian Barnes2019-01-021-0/+1
|
* color: Check format strings + args for cfprintf()Tavian Barnes2019-01-021-4/+5
| | | | | | %{cc} is now ${cc} to avoid warnings about an unrecognized format specifier, and %P and %L are now %pP and %pL to make them look more like standard format strings.
* diag: Unify diagnostic formattingTavian Barnes2019-01-021-23/+40
| | | | | | This adds a bfs: prefix to error/warning messages for consistency with other command line tools, and leaves only the "error:"/"warning:" part colored like GCC. It also uniformly adds full stops after messages.
* stat: Provide a helper for getting human-readable field namesTavian Barnes2018-12-251-23/+2
| | | | And fix -newerXY if the Y time doesn't exist.
* stat: Unify bfs_stat_time() implementationsTavian Barnes2018-12-201-18/+8
|
* stat: Handle statx() not returning some timesTavian Barnes2018-12-191-12/+41
| | | | | | /sys/fs/cgroup, for example, doesn't return access times from statx(). That shouldn't matter unless we actually need them, so make it not an error.
* Implement -acl testTavian Barnes2018-12-171-0/+7
|
* Add new -capable testTavian Barnes2018-12-171-0/+7
|
* bftw: Move bftw_typeflag conversion out of utilTavian Barnes2018-12-171-1/+1
| | | | Turns out incomplete enum types are a GNU C extension.
* Print device major/minor numbers for -lsTavian Barnes2018-11-011-3/+11
|
* Update copyright datesTavian Barnes2018-09-241-1/+1
|
* stat: Don't assume blocks are 512 bytesTavian Barnes2018-07-241-2/+2
| | | | | | | | | | | | POSIX says > The unit for the st_blocks member of the stat structure is not defined > within POSIX.1‐2008. and recommends using DEV_BSIZE from <sys/param.h> if available. Also, for -printf '%S', print 1 instead of NaN for empty files with no blocks.
* eval: Debug all stat() callsTavian Barnes2018-07-151-47/+56
|
* eval: Share the statbuf across multiple -xtype'sTavian Barnes2018-07-121-18/+31
|
* eval: Get rid of duplicate statbuf fieldTavian Barnes2018-07-121-24/+22
| | | | | Also shorten eval_bfs_stat() to eval_stat(). Looks like this was leftover from an incomplete conversion a while ago.
* eval: Fix -delete when following symlinks.Tavian Barnes2018-07-121-2/+15
| | | | | Same bug as https://savannah.gnu.org/bugs/?46305. Please don't ever do this though.
* eval: Don't use %m to report a non-errno errorTavian Barnes2018-06-191-1/+1
| | | | Fixes: 2a45ad01e211d0b36056c21d5211be46195b273d
* eval: Don't unnecessarily zero fields in struct eval_stateTavian Barnes2018-02-011-7/+6
| | | | | | The designated initializer causes everything not mentioned to be zeroed, a waste of time that shows up on profiles. It also has the potential to hide uninitialized-use bugs.
* stat: New wrapper around the stat() familyTavian Barnes2018-01-081-94/+82
| | | | | This lets bfs transparently support the new statx() system call on Linux, giving it access to file birth times.
* Keep track of required FDs per-exprTavian Barnes2017-12-151-1/+3
|