Updating shared libraries

I want to add functionality to PackageKit to detect when a new version of a shared library is installed, and there are applications still using the old version that no longer exists. We can then inform the user if they need to restart the computer or log off and back on if the library was updated for a security vulnerability.

Does anyone have any example code (preferably written in C, although I’m not that bothered) that I could use? I think this would be quite nice functionality in future versions of PackageKit.

Thanks.

8 Responses to “Updating shared libraries”

  1. glandium says:

    Debian has checkrestart, but it’s in python.

  2. Bob Bobson says:

    Why should users have to restart just because they’re updated a library? Doesn’t everyone criticise Windows for that? Just restart the application.

  3. This is any open file in general right, not just libs?
    I wonder could you cross reference deleted file from /proc?
    I.E. see of any of `find /proc/[0-9]*/fd -follow -links 0 2>/dev/null` are the files you just installed.

  4. Alex says:

    I don’t have code for this, and its probably not the best way to do it, but you could parse the contents of /proc/*/maps to collect a list of processes which have the library in question mapped in to their address space.

  5. Jerome Haltom says:

    You can basically troll through /proc/PID/something and pull all of the mapped files. gnome-system-monitor does this.

  6. Frank says:

    After a quick try with lsof: when deleting a shared lib in use by a program, lsof still lists the file with it’s original name, but the ‘fd’ is displayed as “DEL”.
    Maybe that gives you an idea about the direction to look in …

  7. Stu says:

    Can’t you call ldconfig and tell it to update the shared libraries without rebooting ?