Date: Mon, 07 Jan 2002 08:31:44 -0500 From: Dan Eischen <eischen@vigrid.com> To: Doug Rabson <dfr@nlsystems.com> Cc: arch@freebsd.org Subject: Re: Request for review: getcontext, setcontext, etc Message-ID: <3C39A340.81AD7F4C@vigrid.com> References: <Pine.BSF.4.33.0201071214400.94490-100000@herring.nlsystems.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Doug Rabson wrote: > > On Sun, 6 Jan 2002, Dan Eischen wrote: > > > I've got getcontext, setcontext, makecontext, and swapcontext > > implemented and would like to add them to libc. I've made the > > patch available at: > > > > http://people.freebsd.org/~deischen/ucontext/uc-libc-sys.diffs > > > > These are library level versions of these functions. Solaris > > has getcontext and setcontext as system calls. My intent is > > to replace libc_r's use of setjmp/longjmp and jmp_buf munging > > with these functions, so I don't want them as system calls. > > I also want to use them with the KSE-enabled threads library. > > Is there a reason that getcontext and setcontext need to be > > system calls? > > > > For those not familiar with these functions, see: > > > > http://www.opengroup.org/onlinepubs/007908799/xsh/ucontext.h.html > > As far as I can see from reading the code, in makecontext you pass the > value of argc as well as #argc arguments to the new context. The linux > version of makecontext (at least for ia64) doesn't appear to do this - it > just copies #argc longs worth of arguments over to the new stack. Ahh, re-reading the documentation does seem to suggest that the arguments don't include argc. I'll fix that. > The other difference with the linux version is that it uses va_arg(ap, > long) to read the arguments instead of va_arg(ap, int) which makes it > possible to pass 64bit arguments. The SUSv2 spec document does seem to > suggest that the arguments must be integers which makes the linux > behaviour wrong although its probably more useful than truncating > everything to 32bits. Well, even the new IEEE ratified POSIX spec suggests the parameters are integers: "The application shall ensure that the value of argc matches the number of integer arguments passed to func; otherwise, the behavior is undefined." I don't care; if you want to use long arguments, I can change it... -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C39A340.81AD7F4C>