Skip to content

Adding OSAL inotify - #379

Draft
MaciejKaszynski wants to merge 5 commits into
eclipse-score:mainfrom
etas-contrib:create-wait-for-osal
Draft

Adding OSAL inotify#379
MaciejKaszynski wants to merge 5 commits into
eclipse-score:mainfrom
etas-contrib:create-wait-for-osal

Conversation

@MaciejKaszynski

Copy link
Copy Markdown
Contributor

Adding an osal layer for inotify.

The INotifyWatcher is exposes an iterator that wraps the reading from the inotify event queue file, new events appear when available and things are blocked with epoll_wait so that we can sleep. This also allows for interruptions for unit tests.
(note I had to do some funky stuff with epoll for this)

Usage:

    auto res = INotifyWatcher::Create();
    auto watcher = std::move(res).value();
    auto watch = watcher.add_watch("/tmp", IN_CREATE);

    for (const INotifyEvent& event : watcher)
    {
        // will block until a new event is present
        // running touch /tmp/test will print test!
        std::cout << event.name << std::endl;
    };

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: a58ad87f-b35a-4548-bfa1-f528f54d2d03
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (31 packages loaded, 10 targets configured)

Analyzing: target //:license-check (78 packages loaded, 10 targets configured)

Analyzing: target //:license-check (143 packages loaded, 684 targets configured)

Analyzing: target //:license-check (151 packages loaded, 5477 targets configured)

Analyzing: target //:license-check (156 packages loaded, 5498 targets configured)

Analyzing: target //:license-check (161 packages loaded, 5547 targets configured)

Analyzing: target //:license-check (163 packages loaded, 6099 targets configured)

Analyzing: target //:license-check (164 packages loaded, 7434 targets configured)

Analyzing: target //:license-check (164 packages loaded, 7434 targets configured)

Analyzing: target //:license-check (164 packages loaded, 7434 targets configured)

Analyzing: target //:license-check (164 packages loaded, 7434 targets configured)

Analyzing: target //:license-check (167 packages loaded, 10275 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

INFO: Analyzed target //:license-check (169 packages loaded, 10409 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 33.384s, Critical Path: 2.66s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html


score::Result<INotifyWatcher> INotifyWatcher::Create() noexcept
{
int event_queue_fd = ::inotify_init1(IN_CLOEXEC);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to baselibs if eclipse-score/baselibs#420 is done


if (event_queue_fd < 0 || event_fd < 0 || epoll_fd < 0)
{
score::Result<INotifyWatcher>{score::MakeUnexpected(score::mw::lifecycle::ExecErrc::kCommunicationError)};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably return statement is missing here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is in posix folder, but I'm not sure if we don't need separate code for Linux and QNX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants