eclipse-score / eclipse-score/baselibs

feat: Add Linux syslog OS wrapper (score::os::Syslog)

Open
#501 0 comments 0 reactions 0 assignees View on GitHub
comp-osal
Dominant language
C++
Stars
26
Forks
85
Avg merge
2d 13h
Merged PRs (30d)
47

Description

### Feature Request / Modification Description

Linux-only (target_compatible_with @platforms//os:linux), mirrors the existing QNX slog2/slog path exactly, no change to existing LogMode dispatch or QNX behavior.

Add an injectable score::os::Syslog OS wrapper for Linux, mirroring the
existing score::os::qnx::Slog2 triplet pattern (interface / impl / mock).

Today score/os provides no seam over POSIX syslog(3) (openlog/syslog/
vsyslog/closelog), so any Linux consumer that wants to write to the
platform system logger has to call glibc's syslog(3) family directly,
which is not host-unit-testable. This mirrors the QNX slog2 wrapper
exactly, so both platforms expose their native system-logging facility
through the same score::os object-seam convention.

Scope of this request:
- score/os/syslog.h: abstract Syslog interface (openlog/syslog/vsyslog/
closelog) with a Default() factory.
- score/os/syslog_impl.{h,cpp}: SyslogImpl, thin passthrough to glibc's
::openlog/::vsyslog/::closelog.
- score/os/mocklib/mock_syslog.{h,cpp}: MockSyslog gmock double.
- score/os/test/linux/syslog_test.cpp: unit tests for SyslogImpl,
wired into the linux unit_tests_linux test_suite.
- BUILD wiring: new syslog_impl / syslog_mock cc_library targets,
target_compatible_with @platforms//os:linux, matching the qnx:slog2
shape.

This is a prerequisite for a companion feature request against the
logging component, which will consume
@score_baselibs//score/os:syslog to implement a Linux syslog backend
for mw::log's LogMode::kSystem (today only served on QNX via slog2).

No new formal Stakeholder/Tool Requirements are introduced — the added
unit tests reuse the existing generic OS-wrapper requirement
SCR-46010294, already used throughout score/os/test/ (e.g.
qnx/timer_test.cpp, stdio_test.cpp) for this class of thin
POSIX-passthrough wrapper

### Expected Changes of work products

- [ ] Requirements
- [ ] Architecture
- [ ] Safety Analysis
- [ ] Security Analysis
- [ ] Detailed Design
- [x] Implementation and Testing
- [ ] all

### Impact analysis

1. Type of Change Request
New Feature/Component — adds a new score::os OS-abstraction wrapper
(score::os::Syslog). No existing feature is modified.

2. Dependencies on other Change Requests
Depends on eclipse-score/baselibs#501, "Add Linux syslog(3) OS wrapper
(score::os::Syslog)", which provides @score_baselibs//score/os:syslog
consumed by this backend. Should not be merged/released ahead of that
change.

3. Estimates for Realization
- Work products modified: score/os/BUILD, score/os/mocklib/BUILD,
score/os/test/linux/BUILD (additive only); new files syslog.h/.cpp,
syslog_impl.h/.cpp, mocklib/mock_syslog.h/.cpp,
test/linux/syslog_test.cpp.
- Verification: new unit tests (score/os/test/linux/syslog_test.cpp),
wired into the existing linux unit_tests_linux test_suite; covers
openlog/syslog/vsyslog/closelog passthrough and the pmr Default()
factory.
- Effort/resources/risk: small, low risk. New isolated cc_library,
target_compatible_with @platforms//os:linux only; no existing
target's sources, deps, or visibility change.
- Stakeholders: score/os component owners (per CODEOWNERS).
- Milestones: single implementation PR, no phased rollout.

4. Potential Impact on the platform
None on existing platforms. The new targets are
target_compatible_with @platforms//os:linux; QNX and other platform
builds are structurally unaffected (targets simply don't build there),
mirroring how score::os::qnx::Slog2 is scoped to QNX today.

5. Potential Impact on Security
None. SyslogImpl is a thin passthrough to glibc's openlog/vsyslog/
closelog — no new attack surface beyond what glibc's syslog(3) family
already exposes, and no untrusted input is parsed by the wrapper
itself.

6. Potential Impact on Safety
None. QM classified. Mirrors the already-accepted QNX Slog2 wrapper
pattern exactly; the wrapper performs no safety-relevant logic, it
only delegates calls to the OS. Expected ASIL level: QM.

7. License Impact
None. New files use the standard Apache-2.0 SPDX header already used
throughout the repository; no third-party code is introduced.

### Safety or Security relevance

- [x] none
- [ ] Safety relevant
- [ ] Security relevant

### Expected required ASIL classification

QM

### Expected Implementation Version (Release)

1.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the existing score::os::qnx::Slog2 interface, implementation, mock, and BUILD wiring. Then read the requested score/os/syslog.h, syslog_impl.{h,cpp}, mocklib/mock_syslog.{h,cpp}, and test/linux/syslog_test.cpp scope. Done means the Linux-only libraries and test are wired into unit_tests_linux, covering the four syslog calls and Default().

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
build-system, operating-systems, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.