1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-19 18:13:55 +00:00
emacs/lib
Paul Eggert 8654f9d7d6 Use fdopendir, fstatat and readlinkat, for efficiency.
On my host, this speeds up directory-files-and-attributes by a
factor of 3, when applied to Emacs's src directory.
These functions are standardized by POSIX and are common these
days; fall back on a (slower) gnulib implementation if the host
is too old to supply them.
* .bzrignore: Add lib/dirent.h.
* lib/Makefile.am (libgnu_a_SOURCES): Add openat-die.c, save-cwd.c.
* lib/careadlinkat.c, lib/careadlinkat.h: Merge from gnulib,
incorporating: 2013-01-29 careadlinkat: do not provide careadlinkatcwd.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/dirent.in.h, lib/fdopendir.c, lib/fstatat.c, lib/openat-priv.h:
* lib/openat-proc.c, lib/openat.h, m4/dirent_h.m4, m4/fdopendir.m4:
* m4/fstatat.m4: New files, from gnulib.
* lib/openat-die.c, lib/save-cwd.c, lib/save-cwd.h: New files.
These last three are specific to Emacs and are not copied from gnulib.
They are simpler than the gnulib versions and are tuned for Emacs.
* admin/merge-gnulib (GNULIB_MODULES): Add fdopendir, fstatat, readlinkat.
(GNULIB_TOOL_FLAGS): Do not avoid at-internal, openat-h.
Avoid dup, open, opendir.
* nt/inc/sys/stat.h (fstatat):
* nt/inc/unistd.h (readlinkat): New decls.
* src/conf_post.h (GNULIB_SUPPORT_ONLY_AT_FDCWD): Remove.
* src/dired.c: Include <fcntl.h>.
(open_directory): New function, which uses open and fdopendir
rather than opendir.  DOS_NT platforms still use opendir, though.
(directory_files_internal, file_name_completion): Use it.
(file_attributes): New function, with most of the old Ffile_attributes.
(directory_files_internal, Ffile_attributes): Use it.
(file_attributes, file_name_completion_stat): First arg is now fd,
not dir name.  All uses changed.  Use fstatat rather than lstat +
stat.
(file_attributes): Use emacs_readlinkat rather than Ffile_symlink_p.
* src/fileio.c: Include <allocator.h>, <careadlinkat.h>.
(emacs_readlinkat): New function, with much of the old
Ffile_symlink_p, but with an fd argument for speed.
It uses readlinkat rather than careadlinkatcwd, so that it
need not assume the working directory.
(Ffile_symlink_p): Use it.
* src/filelock.c (current_lock_owner): Use emacs_readlinkat
rather than emacs_readlink.
* src/lisp.h (emacs_readlinkat): New decl.
(READLINK_BUFSIZE, emacs_readlink): Remove.
* src/sysdep.c: Do not include <allocator.h>, <careadlinkat.h>.
(emacs_norealloc_allocator, emacs_readlink): Remove.
This stuff is moved to fileio.c.
* src/w32.c (fstatat, readlinkat): New functions.
(careadlinkat): Don't check that fd == AT_FDCWD.
(careadlinkatcwd): Remove; no longer needed.

Fixes: debbugs:13539
2013-01-31 22:30:51 -08:00
..
alloca.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
allocator.c Update from gnulib. 2011-04-08 14:53:30 -07:00
allocator.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
at-func.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
c-ctype.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
c-ctype.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
c-strcase.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
c-strcasecmp.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
c-strncasecmp.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
careadlinkat.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
careadlinkat.h Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
close-stream.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
close-stream.h Fix data-loss with --batch. 2012-11-03 11:54:17 -07:00
COPYING * lib/COPYING: New file, a copy of COPYING. 2011-01-08 23:43:55 -08:00
dirent.in.h Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
dosname.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
dtoastr.c Regenerate. 2011-01-08 17:20:28 -08:00
dtotimespec.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
dup2.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
euidaccess.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
execinfo.c * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files. 2012-08-24 21:27:32 -07:00
execinfo.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
faccessat.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
fcntl.in.h Merge from gnulib. 2013-01-02 08:37:04 -08:00
fdopendir.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
filemode.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
filemode.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
fpending.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
fpending.h Merge from gnulib. 2013-01-02 08:37:04 -08:00
fstatat.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
ftoastr.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
ftoastr.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
getgroups.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
getloadavg.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
getopt1.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
getopt_.h * lib/getopt_.h: Remove trailing CRs that crept in. 2013-01-11 15:28:04 -08:00
getopt_int.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
getopt.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
getopt.in.h Merge from gnulib. 2013-01-09 18:19:44 -08:00
gettext.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
gettime.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
gettimeofday.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
gnulib.mk Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
group-member.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
ignore-value.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
intprops.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
inttypes.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
lstat.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
Makefile.am Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
makefile.w32-in Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca 2013-01-02 08:13:04 -08:00
md5.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
md5.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
min-max.h [ChangeLog] 2011-02-21 15:22:34 -08:00
mktime-internal.h Regenerate. 2011-01-08 22:57:07 -08:00
mktime.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
openat-die.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
openat-priv.h Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
openat-proc.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
openat.h Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
pathmax.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
pselect.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
pthread_sigmask.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
putenv.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
readlink.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
readlinkat.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
root-uid.h Merge from gnulib. 2013-01-02 08:37:04 -08:00
save-cwd.c Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
save-cwd.h Use fdopendir, fstatat and readlinkat, for efficiency. 2013-01-31 22:30:51 -08:00
sha1.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
sha1.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sha256.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
sha256.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sha512.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
sha512.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sig2str.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
sig2str.h Merge from gnulib. 2013-01-02 08:37:04 -08:00
signal.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stat-time.c Merge from gnulib. 2012-08-02 17:42:11 -07:00
stat-time.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stat.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
stdalign.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stdarg.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stdbool.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stddef.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
stdint.in.h Merge from gnulib. 2013-01-16 09:45:39 -08:00
stdio.in.h Merge from gnulib. 2013-01-03 18:17:49 -08:00
stdlib.in.h Merge from gnulib. 2013-01-09 18:19:44 -08:00
strftime.c Spelling fix merged from gnulib. 2013-01-09 00:25:11 -08:00
strftime.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtoimax.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtol.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtoll.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtoul.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtoull.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
strtoumax.c * Makefile.in (GNULIB_MODULES): Add strtoumax. 2011-04-21 12:12:13 -07:00
symlink.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sys_select.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sys_stat.in.h Merge from gnulib. 2013-01-02 08:37:04 -08:00
sys_time.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
sys_types.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
time_r.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
time.in.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
timespec-add.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
timespec-sub.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
timespec.c Merge from gnulib. 2012-08-02 17:42:11 -07:00
timespec.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
u64.c Merge from gnulib. 2012-08-02 17:42:11 -07:00
u64.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
unistd.c Merge from gnulib for 'inline'. 2012-11-30 10:25:59 -08:00
unistd.in.h Merge from gnulib. 2013-01-22 17:47:44 -08:00
unsetenv.c Merge from gnulib. 2013-01-02 08:37:04 -08:00
utimens.c Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
utimens.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
verify.h Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
xalloc-oversized.h Merge from gnulib. 2013-01-02 08:37:04 -08:00