Skip to content

Adding OSAL inotify - #379

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

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

Conversation

@MaciejKaszynski

@MaciejKaszynski MaciejKaszynski commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Adding a small wrapper around score::os::InotifyInstance to get iterator syntax.

Usage:

    auto instance = std::make_unique<score::os::InotifyInstanceImpl>();
    instance.AddWatch("/tmp", score::os::Inotify::EventMask::kInCreate);

    for (const score::os::InotifyEvent& event : INotifyRange{std::move(instance)})
    {
        // will block until a new event is present
        // running touch /tmp/test will print test!
        std::cout << event.GetName() << 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: 8c4abbf8-cf4c-44a2-9efc-93869283c8b6
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
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: 
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 (37 packages loaded, 10 targets configured)

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

Analyzing: target //:license-check (149 packages loaded, 1027 targets configured)

Analyzing: target //:license-check (157 packages loaded, 3970 targets configured)

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

Analyzing: target //:license-check (170 packages loaded, 9397 targets configured)

Analyzing: target //:license-check (170 packages loaded, 9397 targets configured)

Analyzing: target //:license-check (170 packages loaded, 9397 targets configured)

Analyzing: target //:license-check (173 packages loaded, 11285 targets configured)

Analyzing: target //:license-check (173 packages loaded, 11285 targets configured)

INFO: Analyzed target //:license-check (175 packages loaded, 11535 targets configured).
[9 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] [Prepa] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar
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: 56.094s, Critical Path: 2.63s
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

Comment thread score/launch_manager/src/daemon/src/osal/details/posix/inotify_iterator.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/osal/details/posix/inotify_iterator.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/osal/details/posix/inotify_iterator.cpp Outdated
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

#ifndef INOTIFY_RANGE_HPP_

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.

OSAL_INOTIFY_RANGE_HPP_INCLUDED

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.

Just a suggestion, shall we also include namespace in the #def?
SCORE_MW_LIFECYCLE_OSAL_INOTIFY_RANGE_HPP

Comment thread score/launch_manager/src/daemon/src/osal/inotify_range.hpp
namespace score::mw::lifecycle
{

/// @brief A wrapper around score::os::InotiyInstance to get iterator syntax.

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.

Suggested change
/// @brief A wrapper around score::os::InotiyInstance to get iterator syntax.
/// @brief A wrapper around score::os::InotifyInstance to get iterator syntax.

return true;
}

public:

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.

Suggested change
public:

Comment thread score/launch_manager/src/daemon/src/osal/BUILD
score::os::InotifyInstance* instance_{nullptr};

/// @brief Internal buffer of events.
score::cpp::static_vector<score::os::InotifyEvent, score::os::InotifyInstance::max_events> events_{};

@paulquiring paulquiring Aug 3, 2026

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.

@NicolasFussberger @SimonKozik @MaciejKaszynski how sure can we be that score::os::InotifyInstance::max_events will be sufficient?

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.

Can't really control this as this is the buffer that is returned from baselibs, but max_events is just the buffer size. Event's won't be dropped after this they will just be in the file.

By default the value can be found with cat /proc/sys/fs/inotify/max_queued_events which is 16384
The user can configure this so don't think we shall worry about this.

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.

Looks like this is max events per read only...

namespace score
{
namespace os
{

class InotifyInstance
{
  public:
    /**
     * @brief The maximum amount of events a call to Read() can return
     */
    static constexpr const unsigned int max_events{10U};

So you will need to read multiple times, but events should not really be dropped .

@paulquiring paulquiring left a comment

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.

Some findings nothing major.

#include "score/os/utils/inotify/inotify_event.h"
#include "score/os/utils/inotify/inotify_instance.h"

namespace score::mw::lifecycle

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.

Shall we add osal to the namespace?

score::mw::lifecycle::osal or score::mw::lifecycle::internal::osal

But this can get long, so I'm not sure here

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.

3 participants