site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Feb 3, 2008, at 4:43 PM, Edd Dawson wrote: #define _XOPEN_SOURCE #include <ucontext.h> #include <stdio.h> #include <stdlib.h> void die(const char *msg) { perror(msg); exit(666); } void f() { puts("in f()!"); } int main() { ucontext_t ctx; ucontext_t ctx2; if (getcontext(&ctx) == -1) die("getcontext failed\n"); if (getcontext(&ctx2) == -1) die("getcontext failed\n"); ctx2.uc_stack.ss_sp = stack; ctx2.uc_stack.ss_size = sizeof stack; ctx2.uc_link = 0; makecontext(&ctx2, &f, 0); puts("about to swapcontext()..."); if (swapcontext(&ctx, &ctx2) == -1) die("swapcontext failed\n"); return 0; } No, there isn't. - Kevin _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... That seems to have stopped the bus error -- thanks! -- but now I'm getting what I believe is fishy behaviour from swapcontext(). The following program prints "about to swapcontext()..." indefinitely. The 4096-byte stack storage provided is too small for Darwin. The stack size should be at least MINSIGSTKSZ (include signal.h to get this constant). #include <signal.h> char stack[MINSIGSTKSZ]; Again, this behaves as expected on my Linux machine. And with the above changes, this should work as expected on Darwin as well. =) I don't suppose there's a way for "regular people" to see rdar data? This email sent to site_archiver@lists.apple.com