Page MenuHomeFreeBSD

(RFC) stdio: consolidate the two memstream implementations
Needs ReviewPublic

Authored by kevans on Jun 5 2026, 1:09 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 5, 12:50 AM
Unknown Object (File)
Thu, Sep 3, 1:30 PM
Unknown Object (File)
Tue, Sep 1, 12:45 PM
Unknown Object (File)
Fri, Aug 28, 9:00 PM
Unknown Object (File)
Thu, Aug 27, 9:23 PM
Unknown Object (File)
Aug 14 2026, 7:06 PM
Unknown Object (File)
Aug 8 2026, 11:14 AM
Unknown Object (File)
Aug 8 2026, 4:33 AM
Subscribers

Details

Reviewers
jhb
des
Group Reviewers
Klara
Summary

Substantial parts of the memstream and wmemstream implementations
overlap, and it's a little laborious to duplicate code between the two.

Abstract the differences out into some streamcfg structs and see if we
can get the arithmetic right and converge on a single implementation.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73692
Build 70575: arc lint + arc unit

Event Timeline

kevans requested review of this revision.Jun 5 2026, 1:09 AM
lib/libc/stdio/open_memstream.c
97

is newoff here in bytes or in characters? I think the code might be easier to reason about if everything is in characters.

lib/libc/stdio/open_memstream.c
47

See NLINK_MAX in D57324

lib/libc/stdio/open_memstream.c
47

This isn't even needed if we use ckd_add() in the SEEK_END case in memstream_seek().