diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2020-04-12 00:32:29 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2020-04-12 00:32:29 +0000 |
commit | 048fd0a024a01770d6b0dde2a1292cf97867a5e1 (patch) | |
tree | f8f52fac2ab7d30a70bf4b87169518b91340ee5b /Makefile.am | |
parent | 9265a9daab24ad950718a5cccd55ff99269d0070 (diff) | |
download | strace-048fd0a024a01770d6b0dde2a1292cf97867a5e1.tar.gz |
Rewrite decoders of getdents, getdents64, and readdir syscalls
The old approach of allocating memory for all dentries returned by
getdents/getdents64 was problematic, fix it by fetching and printing
dentries sequentially.
* dirent_types.c: New file.
* xgetdents.c: Likewise.
* xgetdents.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.
* dirent.c: Include "xgetdents.h" and "print_fields.h".
(header_size): New variable.
(print_dentry_head, decode_dentry_head, decode_dentry_tail): New
functions.
(print_old_dirent): Rewrite using print_dentry_head.
(SYS_FUNC(getdents)): Rewrite using xgetdents, decode_dentry_head,
and decode_dentry_tail.
* dirent64.c: Include "xgetdents.h", "kernel_dirent.h"
and "print_fields.h" instead of "defs.h", <dirent.h>
and "xlat/dirent_types.h".
(decode_dentry_head, decode_dentry_tail): New functions.
(SYS_FUNC(getdents64)): Rewrite using xgetdents, decode_dentry_head,
and decode_dentry_tail.
Resolves: https://github.com/strace/strace/issues/19
Resolves: https://github.com/strace/strace/pull/20
Diffstat (limited to 'Makefile.am')
-rw-r--r-- | Makefile.am | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index aeb3530e2..c56897a4c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -101,6 +101,7 @@ strace_SOURCES = \ desc.c \ dirent.c \ dirent64.c \ + dirent_types.c \ dm.c \ dyxlat.c \ empty.h \ @@ -365,6 +366,8 @@ strace_SOURCES = \ watchdog_ioctl.c \ xattr.c \ xfs_quota_stat.h \ + xgetdents.c \ + xgetdents.h \ xlat.c \ xlat.h \ xmalloc.c \ |