• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getcontext() -> Bus error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getcontext() -> Bus error?


  • Subject: Re: getcontext() -> Bus error?
  • From: "Duckki Oe" <email@hidden>
  • Date: Sat, 23 Feb 2008 13:23:08 -0600

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.

Duck

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: getcontext() -> Bus error?
      • From: Kevin Van Vechten <email@hidden>
  • Prev by Date: Re: DHCPv6 client support or third-party client?
  • Next by Date: building projects
  • Previous by thread: Re: getcontext() -> Bus error?
  • Next by thread: Re: getcontext() -> Bus error?
  • Index(es):
    • Date
    • Thread