Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A C++ class that uses the Linux kernel's events to watch for changes to /proc/mounts and signals changes

License

Notifications You must be signed in to change notification settings

mmolch/cppmountwatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cppmountwatcher

A C++ class that uses the Linux kernel's events to watch for changes to /proc/mounts and signals changes

Usage

#include <mmolch/MountWatcher.hpp>
#include <iostream>

int main(int argc, char* argv[])
{
    mmolch::MountWatcher mountwatcher;
    mountwatcher.SetEnabled(true);

    auto addedListener = mountwatcher.OnMountAdded([](const std::string& mountDir)
    {
        std::cout << "Mount added: " << mountDir << std::endl;
    });

    auto removedListener = mountwatcher.OnMountRemoved([](const std::string& mountDir)
    {
        std::cout << "Mount removed: " << mountDir << std::endl;
    });


    std::string xxx;
    std::cin >> xxx;
}

Requirements

  • A compiler supporting C++ 20 (only tested on GCC 12.2.0 so far)

TODO

  • Maybe add some (optional) g_volume stuff to also catch gvfs mount changes

About

A C++ class that uses the Linux kernel's events to watch for changes to /proc/mounts and signals changes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published