bproc_detach -- Remove the current process from the BProc process space.


#include <sys/bproc.h>
int bproc_detach(long code);


bproc_detach removes the current process from the global BProc process space. After bproc_detach succeeds, the process continues to execute on its node, but is no longer visible from other nodes. From the viewpoint of other processes in the BProc system, the effect is as if the process had executed exit(code). See exit2 for a description of the effects seen by the parent process.

Return Value

On success, bproc_detach returns zero.

On error, bproc_detach returns -1 and sets errno appropriately.


The caller does not have root permissions.
The BProc system is not loaded in the current kernel.

In addition, any errors listed in fork(2) may occur.


In the current release, bproc_detach may change the PID and PPID of the current process, but is not guaranteed to do so. The PPID may change at some point after bproc_detach has returned, but such behavior is not guaranteed.

In future releases, bproc_detach may be implemented to remove the current process from the BProc system, or it may be implemented to make a copy of the current process outside of the BProc system; other options are also possible. The user should make no assumptions beyond those documented in this man page.

Some implementations of GNU libc cache the value of getpid in userspace; thus, getpid may return inaccurate values if called both before and after bproc_detach.