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.


Published by


Richard has over 10 years of experience developing open source software. He is the maintainer of GNOME Software, PackageKit, GNOME Packagekit, GNOME Power Manager, GNOME Color Manager, colord, and UPower and also contributes to many other projects and opensource standards. Richard has three main areas of interest on the free desktop, color management, package management, and power management. Richard graduated a few years ago from the University of Surrey with a Masters in Electronics Engineering. He now works for Red Hat in the desktop group, and also manages a company selling open source calibration equipment. Richard's outside interests include taking photos and eating good food.

8 thoughts on “Updating shared libraries”

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

  2. 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.

  3. 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.

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

  5. 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 …

Comments are closed.