Page MenuHomeFreeBSD

stack(9): dynamic allocation is not necessary
ClosedPublic

Authored by vangyzen on Mar 7 2022, 1:27 AM.
Tags
None
Referenced Files
F106133768: D34461.diff
Wed, Dec 25, 11:13 PM
Unknown Object (File)
Tue, Dec 17, 8:37 AM
Unknown Object (File)
Nov 22 2024, 2:38 PM
Unknown Object (File)
Nov 21 2024, 12:55 AM
Unknown Object (File)
Nov 16 2024, 3:00 AM
Unknown Object (File)
Nov 11 2024, 2:46 AM
Unknown Object (File)
Nov 4 2024, 10:18 PM
Unknown Object (File)
Oct 29 2024, 4:26 AM

Details

Summary

The man page said dynamic allocation was required, but struct stack
can be allocated in any way, including on the stack. Make this clear,
and explain how to initialize the struct.

While I'm here, stack_save does not require any lock.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 44684
Build 41572: arc lint + arc unit

Event Timeline

English in addition LGTM. Can't speak for consistency with actual KPI.

share/man/man9/stack.9
107

Audience check: would people reading this know (or know how to find out easily) which platforms lack it and how to work around that?

share/man/man9/stack.9
90

This is a bit confusing since calling stack_save() or stack_save_td() would be "creating" a trace per the previous sentence. I'd maybe remove the previous sentence and say something to the effect of, "A struct stack can be defined on the stack and initialized using stack_zero(), or dynamically allocated using stack_create().` etc.

vangyzen added inline comments.
share/man/man9/stack.9
90

Good point.

I also want to clarify that initialization is not needed before stack_save*(), since there are comments in multiple consumers asking this question.

107

For platform support, yes, I think so. I had never looked at this implementation before, and I found the answer in about ten seconds. A workaround really depends on the context, so that seems out of scope here.

vangyzen marked 2 inline comments as done.
  • reword with markj

If it passes the audience check, and since the language looks good, it works as a manual page, barring subject-matter expert concerns.

This revision is now accepted and ready to land.Mar 7 2022, 9:02 PM