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)
Sun, Jul 5, 8:16 AM
Unknown Object (File)
Fri, Jul 3, 6:10 AM
Unknown Object (File)
Mon, Jun 22, 12:08 AM
Unknown Object (File)
Sat, Jun 20, 6:00 PM
Unknown Object (File)
Sat, Jun 20, 6:00 PM
Unknown Object (File)
Sat, Jun 20, 3:39 PM
Unknown Object (File)
Sat, Jun 20, 3:14 PM
Unknown Object (File)
Sat, Jun 20, 11:36 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().