feat(libc): implement setlogmask #3542

Merged
BharatYadav007 merged 1 commit from upstream-pr/3542 into main 2026-10-11 21:32:17 +00:00
BharatYadav007 commented 2026-10-11 12:52:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BharatYadav007 on 2026-10-11T12:52:44Z.


What

Add the missing libc setlogmask export and apply its process-wide mask to syslog and vsyslog before formatting. Zero queries the mask; a nonzero argument replaces it and returns the previous mask. The default is 0xff. Filtering uses severity independently of facility and also applies to the unknown-priority diagnostic.

Behaviour follows FreeBSD 11 syslog.c. Update TechnicalDebt to record that console mask behaviour remains unverified. This implements a logging control explicitly left out of #1729.

Rebased onto upstream main at 1e8fff68c. Checked all 132 open PR heads for overlap; none implements this change.

Tested

Windows, WinLibs MinGW-w64 GCC 15.2.0, Release, BUILD_TESTING=ON.

  • guest_syslog passed on the rebased branch in 0.10 s. Covers queries and previous masks, all severities, facilities, high/negative masks, suppressed %n, diagnostic filtering, errno preservation, and state shared across threads.
  • Full Windows build and libs target passed before rebasing; the build of the refreshed branch is currently running.
  • Conventions check passed. Test-registration check passed for 637 test executables.
  • An additional guest_kernel_sys run failed because the host reports symlink support as unimplemented; no kernel filesystem code is changed by this PR.
  • No title or PS5 hardware testing. Full Linux validation remains for maintainer-run CI.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: no
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819183887 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3542). Originally posted by [BharatYadav007](https://github.com/BharatYadav007) on 2026-10-11T12:52:44Z. --- ### What Add the missing libc `setlogmask` export and apply its process-wide mask to `syslog` and `vsyslog` before formatting. Zero queries the mask; a nonzero argument replaces it and returns the previous mask. The default is `0xff`. Filtering uses severity independently of facility and also applies to the unknown-priority diagnostic. Behaviour follows [FreeBSD 11 syslog.c](https://github.com/freebsd/freebsd-src/blob/8d2708de5d6112a492744d367cfdfb8fd219227a/lib/libc/gen/syslog.c). Update TechnicalDebt to record that console mask behaviour remains unverified. This implements a logging control explicitly left out of #1729. Rebased onto upstream main at `1e8fff68c`. Checked all 132 open PR heads for overlap; none implements this change. ### Tested Windows, WinLibs MinGW-w64 GCC 15.2.0, Release, BUILD_TESTING=ON. - `guest_syslog` passed on the rebased branch in 0.10 s. Covers queries and previous masks, all severities, facilities, high/negative masks, suppressed `%n`, diagnostic filtering, errno preservation, and state shared across threads. - Full Windows build and `libs` target passed before rebasing; the build of the refreshed branch is currently running. - Conventions check passed. Test-registration check passed for 637 test executables. - An additional `guest_kernel_sys` run failed because the host reports symlink support as unimplemented; no kernel filesystem code is changed by this PR. - No title or PS5 hardware testing. Full Linux validation remains for maintainer-run CI. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: no
copilot-pull-request-reviewer[bot] commented 2026-10-11 12:54:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-11T12:54:34Z.

Review: COMMENTED


The implementation matches the documented behavior and is covered by focused tests.

0 open findings

What changed in this PR

Implements process-wide libc setlogmask behavior and applies severity filtering to syslog output.

Changes:

  • Adds thread-safe mask querying and replacement.
  • Filters messages and diagnostics before formatting.
  • Expands syslog tests and technical-debt documentation.
File Description
core/​libs/​prx/​libc/​src/​Syslog.cpp Implements and applies the shared log mask.
core/​libs/​tests/​GuestSyslog.cpp Tests filtering, mask semantics, errno, and threading.
docs/​dev/​TechnicalDebt.md Documents implemented and unverified behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5483372894 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3542#pullrequestreview-5483372894). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-10-11T12:54:34Z. **Review:** COMMENTED --- <!-- ccr-overview-v2 --> ### 🟢 Approval recommended The implementation matches the documented behavior and is covered by focused tests. **0 open findings** <details> <summary><strong>What changed in this PR</strong></summary> Implements process-wide libc `setlogmask` behavior and applies severity filtering to syslog output. **Changes:** - Adds thread-safe mask querying and replacement. - Filters messages and diagnostics before formatting. - Expands syslog tests and technical-debt documentation. | File | Description | | ---- | ----------- | | `core/​libs/​prx/​libc/​src/​Syslog.cpp` | Implements and applies the shared log mask. | | `core/​libs/​tests/​GuestSyslog.cpp` | Tests filtering, mask semantics, errno, and threading. | | `docs/​dev/​TechnicalDebt.md` | Documents implemented and unverified behavior. | </details> 🧠 **Review effort:** Balanced --- 💡 <a href="/boykopovar/AnyPS5/new/main?filename=.github/skills/code-review/SKILL.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add a `code-review` agent skill</a> or configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>
github-actions[bot] commented 2026-10-11 13:20:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T13:20:07Z.


Progress report (a11c8f7 → 8355b1f)

📈 System libraries: 85.82% (+0.01%, +1 implemented functions)

✅ 1 implemented
Library Name
libc setlogmask_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109453852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3542#issuecomment-6109453852). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T13:20:07Z. --- <!-- progress-report --> ### Progress report (a11c8f7 → 8355b1f) 📈 **System libraries**: 85.82% (+0.01%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `setlogmask_nid_postfix` | </details>
adriadam10 commented 2026-10-11 21:32:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:32:13Z.


Checked build + ctest on Linux (guest_syslog passes, and doesn't link without the change), setlogmask semantics and the mask check order against FreeBSD lib/libc/gen/syslog.c, and the TechnicalDebt line; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114006504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3542#issuecomment-6114006504). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:32:13Z. --- Checked build + ctest on Linux (`guest_syslog` passes, and doesn't link without the change), `setlogmask` semantics and the mask check order against FreeBSD `lib/libc/gen/syslog.c`, and the TechnicalDebt line; merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3542
No description provided.