Commit Graph

4 Commits

Author SHA1 Message Date
milescoviello 42bf2a2ad3 fix(libc): format guest wide arguments in syslog on Linux
vsyslog formats the message with the host's vsnprintf on Linux, so a
%ls, %S, %lc or %C argument is read as glibc's 32-bit wchar_t instead
of the guest's 16-bit units. glibc fails the conversion and the message
is dropped: on main syslog(LOG_DEBUG, "wide %ls %d %S", u"guest", 5,
u"text") writes "[syslog:15] " with nothing after it. Windows already
formats syslog messages with the guest formatter, and the narrow printf
family does so on Linux for formats with a guest wide conversion.

FreeBSD 11.4 lib/libc/gen/syslog.c line 229 formats the message with

	(void)vfprintf(fp, fmt, ap);

and lib/libc/stdio/vfprintf.c (lines 831-843) converts %S and %ls from
the guest's wchar_t:

	case 'S':
		flags |= LONGINT;
		/*FALLTHROUGH*/
	case 's':
		if (flags & LONGINT) {
			wchar_t *wcp;
	...
				convbuf = __wcsconv(wcp, prec);

vsyslog now formats through the guest's vsnprintf, which hands formats
with a guest wide conversion to the guest formatter (UTF-8 output, as
for printf) and every other format to glibc as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 02:52:07 +00:00
BharatYadav007 8355b1f7b8 feat(libc): implement setlogmask 2026-10-11 18:07:14 +05:30
Adrià Franch 9d1ac9033e fix(libc): report unknown syslog bits with FreeBSD's internal priority
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>
2026-10-09 23:23:49 +02:00
john.maia bcd1b0c2a0 feat(libc): implement syslog and vsyslog
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>
2026-10-09 23:23:42 +02:00