1

glib supports several file monitors. The used monitor can be detected by calling G_OBJECT_TYPE_NAME (monitor).

When using the gio program, there is no documented way to determine this. Or is it possible?

Michael Albinus
  • 1,571
  • 9
  • 19
  • 1
    What do you mean by several file monitors? There's just GFileMonitor and that's what the gio tool uses when using `gio monitor ` – Jussi Kukkonen Mar 25 '21 at 19:12
  • There are several implementations (backends): GFamFileMonitor, GInotifyFileMonitor, GKqueueFileMonitor and GPollFileMonitor at least. I need to know which implementation is used. – Michael Albinus Mar 25 '21 at 19:20
  • 1
    Oh now I got it: you want the internal implementation. The tool uses the public gio API so it doesn't even know. Are you sure you need to know that? – Jussi Kukkonen Mar 25 '21 at 19:20
  • 1
    Yes, I am. I'm writing regression tests for `gio monitor`, and the fired events differ, depending on the backend. – Michael Albinus Mar 25 '21 at 19:24
  • 2
    So what you probably want is to force a specific monitor implementation... one of the environment variables like `GIO_USE_FILE_MONITOR=inotify` might help? – Jussi Kukkonen Mar 25 '21 at 19:31
  • That's a good indication, thanks. However, my test scenarii are more complex. I connect a remote server, and I do run `gio monitor` there for my tests. I don't know what the server is running - it could be GNU/Linux, FreeBSD, macOS, cygwin, Solaris, you name it. That's why I want to have a simple check about the backend gio is using. – Michael Albinus Mar 25 '21 at 19:36
  • Well, you'll nailed it. `env GIO_USE_FILE_MONITOR=help gio monitor /` returns exactly the information I am looking for. – Michael Albinus Mar 25 '21 at 19:39

0 Answers0