Skip to content

feat(libc): implement syslog and vsyslog - #1729

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
johnmaia:feat/libc-syslog
Oct 9, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
johnmaia:feat/libc-syslog

Conversation

@johnmaia

@johnmaia johnmaia commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

Implements syslog (NID s-e0hFe21FA) and vsyslog (NID rzvf5zicF88) in libc. Two of the homebrew titles in #1578 import syslog from libSceLibcInternal, which resolves through libc: ps5-opengl (PPSA99005) and ProsperoRadio (PPSA99001).

  • Output: each message is written to stderr as [syslog:<priority>] <message>, under a lock and flushed, with a newline added when the message has none. This is the same convention sceKernelDebugOutText uses ([debug:<channel>]).
  • Format and priority follow FreeBSD's vsyslog:
    • %m expands to the guest errno's message (FreeBSD numbering via strerror_r), with any % in it doubled, and %%m stays a literal %m.
    • Bits outside LOG_PRIMASK | LOG_FACMASK produce syslog: unknown facility/priority: <hex> and are then masked off.
    • A missing facility becomes LOG_USER.
    • errno is preserved.
  • Formatting uses the same paths as vfprintf: SysV va_list on Linux and LibcDetail::FormatWindows on Windows.
  • Recorded in TechnicalDebt: messages go to stderr instead of the console's system log, and openlog, setlogmask and closelog are not implemented, so identity, options and mask are not applied. Neither title imports them.

Tested

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 (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Progress report (54f28f2 → 9d1ac90)

📈 System libraries: 85.31% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libc syslog_nid_postfix
libc vsyslog_nid_postfix

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1727 __error_nid_postfix
#1738 __error_nid_postfix
#1772 __error_nid_postfix
#1831 docs/dev/TechnicalDebt.md L362
#1860 __error_nid_postfix
#2051 __error_nid_postfix
#2057 core/libs/prx/libc/CMakeLists.txt L235
#2123 __error_nid_postfix

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 8, 2026
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 8, 2026
johnmaia and others added 2 commits October 9, 2026 23:23
ps5-opengl (PPSA99005) and ProsperoRadio (PPSA99001) import syslog
from libSceLibcInternal. Messages go to stderr with the priority, and
the format follows FreeBSD's vsyslog: %m expansion, masking of unknown
priority bits, LOG_USER as the default facility, errno preserved.

Assisted by Claude Code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FreeBSD vsyslog logs the complaint with LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID passed as the priority (0x23), not LOG_ERR.

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build + full ctest on Linux (guest_syslog passes and fails without the change), and %m/%%/facility handling against FreeBSD lib/libc/gen/syslog.c; the Windows relinker failure is the runner's clang lacking the amdgcn target, unrelated to this PR.

One fix added as a separate commit on your branch:

  • FreeBSD reports the "unknown facility/priority" complaint through syslog(LOG_ERR|LOG_CONS|LOG_PERROR|LOG_PID, ...), so the priority it logs is 0x23, not 3. Syslog.cpp, the test expectation ([syslog:35]) and the TechnicalDebt line now say so.

Not verified here: Windows runtime of the formatting path and any title. Merging once CI is green.

@adriadam10
adriadam10 merged commit 64c6b11 into boykopovar:main Oct 9, 2026
8 checks passed
@BharatYadav007 BharatYadav007 mentioned this pull request Oct 11, 2026
9 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants