Hello all,

    I noticed that a few of my RHEL6 machines were not reporting what
I expected from them in the output of needs-restarting from yum-utils
(version yum-utils-1.1.30-17.el6_5) so I started digging into the
needs-restarting code and I noticed that it's looking for 'fd:' in a line
of output in /proc/$pid/smaps which is a device field (if I understand
the kernel docs correctly).

I was curious if there is any reason that's looking for a device field
specifically and not just a '/' character? I don't have a "fd:" in any
of /proc/*/smaps on a number of my machines so I modified the code a
little with this patch:

--- ./needs-restarting  2014-06-18 17:23:24.000317137 -0400
+++ ./needs-restarting-patched  2014-06-18 17:22:30.532480358 -0400
@@ -82,10 +82,10 @@
         return files

     for line in maps.readlines():
-        if line.find('fd:') == -1:
+        slash = line.find('/')
+        if slash == -1:
             continue
         line = line.replace('\n', '')
-        slash = line.find('/')
         filename = line[slash:]
         filename = filename.replace('(deleted)', '') #only mildly retarded
         filename = filename.strip()


Using that it works as I expected. I tested it by downgrading java,
starting activemq, upgrading java, and running 'needs-restarting'. It
correctly showed the process that needed to be restarted where it didn't
before the patch.

My question ultimately is:

    Am I correct in what I did or is there a deeper motivation for
    targeting "fd:" as the search criteria in the output from
    /proc/$pid/smaps that I'm not familiar with?

I wanted to bring this to the list before filing a line-noise BZ (though
in retrospect it's likely about the same).

Thanks in advance,
-AdamM
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to