Heiby%hi-multics@sri-unix.UUCP (10/20/83)
From: Ronald W. <Heiby@hi-multics> In the 4.1bsd leave.c, there is a call to function setexit(). I found no other references to it in /usr/src/cmd hierarchy or in the manual set. Can anyone tell me what it does, where it is documented, or where the source for it is? Thanks much. Ron <Heiby @ HI-Multics.ARPA>.
dan%bbncd@sri-unix.UUCP (10/21/83)
From: Dan Franklin <dan@bbncd>
setexit() and reset() were the crude V6 primitives that were later generalized
to setjmp and longjmp. They take no arguments, and can be simulated with
#include <setjmp.h>
jmp_buf label;
#define setexit() setjmp(label)
#define reset() longjmp(label, 0)
at the beginning of any program using them. In other words, setexit() was like
setjmp of a built-in fixed "jmp_buf"; reset() was like a longjmp to that
"jmp_buf". Unlike setjmp(), however, you could not find out from the return
value of setexit() whether you were setting it up or returning from a reset()
(in standard V6, that is; we changed ours to return nonzero on reset(), and
probably other people did the same thing).
Dan Franklin (dan@bbn-unix)dbj.rice%rand-relay@sri-unix.UUCP (10/21/83)
From: Dave Johnson <dbj.rice@rand-relay>
The source for setexit() and reset() is in /usr/src/libc/sys/reset.s. The
only documentation I know of for them is the comment at the top of the
source file:
# reset(x)
# will generate a "return" from
# the last call to
# setexit()
# by restoring r6 - r12, ap, fp
# and doing a return.
# The returned value is x; on the original
# call the returned value is 0.
#
# useful for going back to the main loop
# after a horrible error in a lowlevel
# routine.
Dave Johnson
Dept. of Math Science
Rice University
dbj.rice@Rand-Relayguy@rlgvax.UUCP (Guy Harris) (10/25/83)
I believe later versions of setexit/reset (which were published in the USENIX
newsletter, and I believe were in PWB/UNIX 1.0) had "reset" take an argument
like "longjmp" which was "returned" by "setexit" when it came back from the
"reset".
Guy Harris
{seismo,mcnc,brl-bmd,allegra}!rlgvax!guybob@unm-cvax.UUCP (10/25/83)
Setexit() is old v6/pwb stuff. It was replaced by the more general setjmp().
A call to reset() should also be in there and that was changed to longjmp().
The main difference between setexit/reset and setjmp/longjmp is that you have
the possibility of more than one environment with the later.
-- bob
--
Bob Tomlinson - (505) 277-6131
{ ucbvax!lbl-csam, purdue, cmcl2 } !lanl-a!unm-cvax!bob
Univ. of New Mexico - 2701 Campus Blvd. - Albuquerque, NM 87131