Re: What is the equivalent of the linux system call clone() on FreeBSD?

From: Brooks Davis <brooks_at_freebsd.org>
Date: Fri, 07 Jul 2023 21:53:41 UTC
On Fri, Jul 07, 2023 at 01:45:53PM -0700, Yuri wrote:
> Linux has the clone() function that allows the caller more control over 
> process cloning than the fork(2) function does.
> 
> FreeBSD only has clone() in its Linux emulator code for Linux apps, but 
> it seems to be missing in the system.
> 
> Is there a library that implements functionality similar to Linux's clone()?
> 
> Otherwise, how can clone() calls like this 
> https://github.com/cea-hpc/wi4mpi/blob/master/src/common/helper.c#L82 be 
> resolved on FreeBSD?

clone is at least partially implemented in terms of rfork(2) flags.
It's not immediately obvious what the code is doing so I can't comment
if you'll be able to do what you need rfork if if you really need a
clone implementation.

-- Brooks