[Toybox] fun with vfork

Rob Landley rob at landley.net
Wed Oct 12 17:49:49 PDT 2016


On 10/11/2016 12:04 PM, Josh Gao wrote:
> Do you have vfork tagged with __attribute__((returns_twice))? AFAIK,
> that's the incantation to get gcc to do the right thing for setjmpy
> functions.

Do I have it tagged, or do you mean does glibc? (I didn't implement
vfork, it came with libc.) Let's see, grep says glibc in Ubuntu 14.04
just has:

  /usr/include/unistd.h:extern __pid_t vfork (void) __THROW;

And checking musl...

  pid_t vfork(void);

In fact grep -r returns_twice is not finding any instances of it under
/usr/include or under the musl source dir.

So... no? I think? Is there a way _I_ can tag this? (I can't do my own
vfork prototype because I can't #undef the one I get out of unistd.h and
that's a fairly generic header. It's sad I can't redo function
prototypes after the fact, but the language never gave me a way to.
Maybe I could do a gratuitous wrapper around it?)

How does setjmp() itself do this...

/usr/include/setjmp.h:extern int setjmp (jmp_buf __env) __THROWNL;

And sys/cdefs.h #defines __THROWNL as nothing for non-c++ builds.

Rob



More information about the Toybox mailing list