Author: brane
Date: Sat Oct 13 19:42:23 2018
New Revision: 1843779
URL: http://svn.apache.org/viewvc?rev=1843779&view=rev
Log:
Improve the loaded-libraries list on Linux.
* subversion/libsvn_subr/sysinfo.c (linux_shared_libs):
Avoid expensivs stat() calls, relying instead on the info in
/proc/*/maps being up-to-date even for deleted files.
Modified:
subversion/trunk/subversion/libsvn_subr/sysinfo.c
Modified: subversion/trunk/subversion/libsvn_subr/sysinfo.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sysinfo.c?rev=1843779&r1=1843778&r2=1843779&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sysinfo.c Sat Oct 13 19:42:23 2018
@@ -696,9 +696,7 @@ linux_shared_libs(apr_pool_t *pool)
/* Each line in /proc/<pid>/maps consists of whitespace-delimited fields. */
while (!eof)
{
- svn_version_ext_loaded_lib_t *lib;
svn_stringbuf_t *line;
- svn_node_kind_t kind;
err = svn_stream_readline(stream, &line, "\n", &eof, pool);
if (err)
@@ -710,8 +708,8 @@ linux_shared_libs(apr_pool_t *pool)
/* Find the permissions of the mapped region. */
stringbuf_skip_whitespace_field(line); /* skip address */
- /* Permissions: The memory region must be executable. */
- if (line->len < 4 || line->data[2] != 'x')
+ /* Permissions: The memory region must be readable and executable. */
+ if (line->len < 4 || line->data[0] != 'r' || line->data[2] != 'x')
continue;
stringbuf_skip_whitespace_field(line); /* skip perms */
@@ -725,11 +723,13 @@ linux_shared_libs(apr_pool_t *pool)
stringbuf_skip_whitespace_field(line); /* skip inode */
- /* Check that the file exists. */
- err = svn_io_check_path(line->data, &kind, pool);
- svn_error_clear(err);
- if (!err && kind == svn_node_file)
+ /* Record anything that looks like an absolute path.
+ Files that were removed since the process was created (due to an
+ upgrade, for example) are marked as '(deleted)'. */
+ if (line->data[0] == '/')
{
+ svn_version_ext_loaded_lib_t *lib;
+
if (!result)
{
result = apr_array_make(pool, 32, sizeof(*lib));