Page MenuHomeFreeBSD

stack(9): dynamic allocation is not necessary
ClosedPublic

Authored by vangyzen on Mar 7 2022, 1:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, May 17, 4:59 AM
Unknown Object (File)
Sun, May 12, 8:20 PM
Unknown Object (File)
Sun, May 12, 8:20 PM
Unknown Object (File)
Sun, May 12, 8:20 PM
Unknown Object (File)
Sun, May 12, 8:17 PM
Unknown Object (File)
Sat, May 11, 10:12 AM
Unknown Object (File)
Thu, May 9, 9:50 PM
Unknown Object (File)
Wed, May 8, 6:26 PM

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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