site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com On Feb 23, 2008, at 11:23 AM, Duckki Oe wrote: - 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... I was experiencing difficulties with getcontext/makecontext last night. (you know.. getting SIGBUS, seg fault) And I've figured out that Darwin's ucontext_t is not like that of linux's. ucontext_t on Darwin (I'm using Mac OS X 10.5.2.) does not contain the mcontext_t, which stores machine dependent context. And let users allocate the mcontext_t buffer and point it in uc_mcontext member of ucontext_t. Or it just assumes mcontext_t buffer follows the ucontext_t variable. You may need to look into the actual ucontext_t structure in /usr/include/sys/ucontext.h. It's better to allocate ucontext_t using malloc with the length of sizeof(ucontext_t) + sizeof(*((mcontext_t)0)). Note that mcontext_t is just a pointer. Now it should work fine. This is not documented on the man pages. On the other hand, Linux's ucontext_t CONTAINS the whole structure of mcontext_t and you don't have to care about additional buffer. This was the issue I originally replied to on this thread. The ucontext_t only includes mcontext_t when _XOPEN_SOURCE is defined prior to including the header files (see /usr/include/sys/_structs.h). This email sent to site_archiver@lists.apple.com
participants (1)
-
Kevin Van Vechten