Clone-equivalent plugs?

I would like to use function namespacing functions clone. The reading manpage seems to clonecontain a lot of complex details that I need to worry about.

Is there an equivalent call clonefor good ol ' fork()?

I am already familiar with forkand believe that if I have a starting point in clone, I can add flags and options there.

+5
source share
3 answers

I think this will work, but I'm not quite sure about some pointer arguments.

pid_t child = clone( child_f, child_stack, 
           /* int flags                */     SIGCHLD, 
           /* argument to child_f      */     NULL,
           /* pid_t *pid               */     NULL,
           /* struct usr_desc * tls    */     NULL,
           /* pid_t *ctid              */     NULL );

flags , , , . , , fork. , .

- fork, sys_clone, , fork.

+2

fork(), unshare() .

, .

+1

clone() . clone() fork() , clone() , - , fork() , . int (* fn) (void *) manpage - , int, .

The closest clone call is pthread_create (), which is essentially a wrapper for clone (). This will not help you get the fork () behavior.

0
source

All Articles