]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: tune usage of getxattr/stat syscalls
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Oct 2024 04:11:02 +0000 (21:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Oct 2024 06:03:04 +0000 (23:03 -0700)
commit2a6bed9332bd58260923f17a9fcfa372b2349db1
tree34864c7fceff08edd8de020fe16f279c382af951
parent8fbb1076d5bdf84f84da391a0e3377ffe014de5a
ls: tune usage of getxattr/stat syscalls

Update gnulib submodule to latest.  This changes the file_has_aclinfo
API, so at the same time do the following changes to ls.c, which
adjusts to these changes among other things.
* src/ls.c (filetype_d_type, d_type_filetype): New static constants.
(format_needs_capability): New static var.
(main): Set and use it.  Don’t set format_needs_stat merely
because print_scontext, as we needn’t call stat to get the
scontext.  Instead, set format_needs_type if print_scontext but
not format_needs_stat.
(print_dir): Use new static tables to determine filetype
more efficiently.
(file_has_aclinfo_cache): Adjust to Gnulib file_has_aclinfo API change.
(gobble_file): Check stat if format_needs_type but the type is
unknown.  Be conservative, and when deciding whether to check stat
but the type is unknown, assume it might be directory.  Similarly
for normal files when classifying; if the type is unknown assume
it might be normal.  Use new static constants and IFTODT to
compute filetype more straightforwardly.  Get ACLs and check for
capability less often.
(get_color_indicator): Omit unnecessary call to is_colored (C_CAP),
since f->has_capability can be true only if is_colored (C_CAP).
gnulib
src/ls.c