Thread View: muc.lists.netbsd.tech.userlevel
8 messages
8 total messages
Started by Jan Schaumann
Sat, 24 Oct 2026 23:25
setjmp(3) clarification
Author: Jan Schaumann
Date: Sat, 24 Oct 2026 23:25
Date: Sat, 24 Oct 2026 23:25
59 lines
3241 bytes
3241 bytes
--73St8WFddzvjtAO4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, setjmp(3) notes that the functions "save their calling environment". For many people perusing library function manual pages, the term "environment" primarily brings to mind the _process_ environment (as in "environment variables"). I think it might be useful to nudge people's thinking a bit more towards the actual meaning. Does that seem reasonable? -Jan --73St8WFddzvjtAO4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Index: setjmp.3 =================================================================== RCS file: /cvsroot/src/lib/libc/gen/setjmp.3,v retrieving revision 1.18 diff -u -p -r1.18 setjmp.3 --- setjmp.3 24 May 2021 23:59:59 -0000 1.18 +++ setjmp.3 24 Oct 2026 21:55:00 -0000 @@ -33,7 +33,7 @@ .\" .\" @(#)setjmp.3 8.1 (Berkeley) 6/4/93 .\" -.Dd June 1, 2008 +.Dd October 24, 2026 .Dt SETJMP 3 .Os .Sh NAME @@ -69,7 +69,9 @@ The .Fn setjmp , and .Fn _setjmp -functions save their calling environment in +functions save their calling stack environment (a register +set including the stack pointer, instruction pointer, +and possibly signal mask) in .Fa env . Each of these functions returns 0. .Pp --73St8WFddzvjtAO4-- -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Valery Ushakov
Date: Sun, 25 Oct 2026 00:34
Date: Sun, 25 Oct 2026 00:34
31 lines
2193 bytes
2193 bytes
On Sat, Oct 24, 2026 at 19:25:16 -0400, Jan Schaumann wrote:
> setjmp(3) notes that the functions "save their calling
> environment".
>
> For many people perusing library function manual
> pages, the term "environment" primarily brings to mind
> the _process_ environment (as in "environment
> variables").
>
> I think it might be useful to nudge people's thinking
> a bit more towards the actual meaning.
>
> Does that seem reasonable?
I see where you are coming from, but I don't really like this change.
It doesn't help too much someone who doens't know about jmp functions
and this is probably not the right place to give them a tutorial. And
the next paragraph says more or less the same thing when it says "as
if..."
Our current text ("calling environment") is aligned with posix, I
think. "Calling _stack_ environment" is also misleading as jmpbuf
saves register contents, so it's kinda true, and it kinda isn't and
that just rubs me the wrong way...
-uwe
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Emmanuel Dreyfus
Date: Sun, 25 Oct 2026 00:45
Date: Sun, 25 Oct 2026 00:45
18 lines
2702 bytes
2702 bytes
On Sat, Oct 24, 2026 at 07:25:16PM -0400, Jan Schaumann wrote: > For many people perusing library function manual > pages, the term "environment" primarily brings to mind > the _process_ environment (as in "environment > variables"). Perhaps just replace "calling environment" by "process context" ? It is the term that is used in sigaction(2) -- Emmanuel Dreyfus manu@netbsd.org -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Joerg Sonnenberger
Date: Sun, 25 Oct 2026 09:49
Date: Sun, 25 Oct 2026 09:49
21 lines
2757 bytes
2757 bytes
On 10/25/26 1:25 AM, Jan Schaumann wrote: > For many people perusing library function manual > pages, the term "environment" primarily brings to mind > the _process_ environment (as in "environment > variables"). > > I think it might be useful to nudge people's thinking > a bit more towards the actual meaning. I think this is misleading just as much. On most architectures, we in fact don't have to save all the registers and we shouldn't promise to do that either. It's a functional call, so anything not caller-preserved can be gone. Joerg -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Jan Schaumann
Date: Sun, 25 Oct 2026 14:44
Date: Sun, 25 Oct 2026 14:44
17 lines
2437 bytes
2437 bytes
Emmanuel Dreyfus <manu@netbsd.org> wrote: > On Sat, Oct 24, 2026 at 07:25:16PM -0400, Jan Schaumann wrote: > > For many people perusing library function manual > > pages, the term "environment" primarily brings to mind > > the _process_ environment (as in "environment > > variables"). > > Perhaps just replace "calling environment" by "process context" ? > It is the term that is used in sigaction(2) That would work for me. -Jan -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Martin Husemann
Date: Sun, 25 Oct 2026 14:50
Date: Sun, 25 Oct 2026 14:50
17 lines
1651 bytes
1651 bytes
On Sun, Oct 25, 2026 at 10:44:17AM -0400, Jan Schaumann wrote: > > Perhaps just replace "calling environment" by "process context" ? > > It is the term that is used in sigaction(2) > > That would work for me. But sigaction is about the kernel snapshotting a process context and totally different form setjmp(3) which is plain userland and not related to the kernel's idea of the process's state. I would leave the text as-is. Martin -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: Greg Troxel
Date: Sun, 25 Oct 2026 15:54
Date: Sun, 25 Oct 2026 15:54
25 lines
2474 bytes
2474 bytes
Martin Husemann <martin@duskware.de> writes: > I would leave the text as-is. https://pubs.opengroup.org/onlinepubs/9799919799/functions/setjmp.html POSIX says, with a note that really ISO C defines it: A call to setjmp() shall save the calling environment in its env argument for later use by longjmp(). I think the man page is fine as is, and that we should not wordsmith text from ISO C and POSIX. The explanatory text about setjmp/longjmp seems reasonably clear, given that this is a fairly advanced programming concept. So I see nothing that needs fixing in NetBSD. If someone thinks the ISO C text should change, <humor>I'm sure they have a public bug-tracker someplace</>. -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Re: setjmp(3) clarification
Author: David Holland
Date: Sun, 01 Nov 2026 18:31
Date: Sun, 01 Nov 2026 18:31
37 lines
3354 bytes
3354 bytes
On Sun, Oct 25, 2026 at 11:54:00AM -0400, Greg Troxel wrote: > > I would leave the text as-is. > > https://pubs.opengroup.org/onlinepubs/9799919799/functions/setjmp.html > > POSIX says, with a note that really ISO C defines it: > > A call to setjmp() shall save the calling environment in its env > argument for later use by longjmp(). > > I think the man page is fine as is, and that we should not wordsmith > text from ISO C and POSIX. The explanatory text about setjmp/longjmp > seems reasonably clear, given that this is a fairly advanced programming > concept. So I see nothing that needs fixing in NetBSD. > > If someone thinks the ISO C text should change, <humor>I'm sure they > have a public bug-tracker someplace</>. I don't agree; standards text is routinely confusing or misleading to those not steeped in the assumptions and context of the standard involved. The man page already discusses almost all the things necessary to explain in full, just not in the right order for someone who doesn't already know exactly what the words mean. My inclination would be to go rewrite the whole page rather than trying to patch it. (although if someone really wanted to patch it, I think "execution environment" might work better than the things already proposed) -- David A. Holland dholland@netbsd.org -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads