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, Aug 8, 11:14 AM
Unknown Object (File)
Sat, Aug 8, 4:33 AM
Unknown Object (File)
Sun, Aug 2, 5:54 AM
Unknown Object (File)
Sat, Aug 1, 6:22 AM
Unknown Object (File)
Fri, Jul 24, 3:04 PM
Unknown Object (File)
Thu, Jul 23, 3:48 AM
Unknown Object (File)
Tue, Jul 21, 3:59 PM
Unknown Object (File)
Mon, Jul 20, 2:48 PM
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().