.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "IBV_FORK_INIT" "3" "2006-10-31" "libibverbs" "Libibverbs Programmer\[cq]s Manual" .hy .SH NAME .PP ibv_fork_init - initialize libibverbs to support fork() .SH SYNOPSIS .IP .nf \f[C] #include int ibv_fork_init(void); \f[R] .fi .SH DESCRIPTION .PP \f[B]ibv_fork_init()\f[R] initializes libibverbs\[cq]s data structures to handle \f[B]fork()\f[R] function calls correctly and avoid data corruption, whether \f[B]fork()\f[R] is called explicitly or implicitly (such as in \f[B]system()\f[R]). .PP It is not necessary to use this function if all parent process threads are always blocked until all child processes end or change address spaces via an \f[B]exec()\f[R] operation. .SH RETURN VALUE .PP \f[B]ibv_fork_init()\f[R] returns 0 on success, or the value of errno on failure (which indicates the failure reason). .SH NOTES .PP \f[B]ibv_fork_init()\f[R] works on Linux kernels supporting the \f[B]MADV_DONTFORK\f[R] flag for \f[B]madvise()\f[R] (2.6.17 and higher). .PP Setting the environment variable \f[B]RDMAV_FORK_SAFE\f[R] or \f[B]IBV_FORK_SAFE\f[R] has the same effect as calling \f[B]ibv_fork_init()\f[R]. .PP Setting the environment variable \f[B]RDMAV_HUGEPAGES_SAFE\f[R] tells the library to check the underlying page size used by the kernel for memory regions. This is required if an application uses huge pages either directly or indirectly via a library such as libhugetlbfs. .PP Calling \f[B]ibv_fork_init()\f[R] will reduce performance due to an extra system call for every memory registration, and the additional memory allocated to track memory regions. The precise performance impact depends on the workload and usually will not be significant. .PP Setting \f[B]RDMAV_HUGEPAGES_SAFE\f[R] adds further overhead to all memory registrations. .SH SEE ALSO .PP \f[B]exec\f[R](3), \f[B]fork\f[R](2), \f[B]ibv_get_device_list\f[R](3), \f[B]system\f[R](3), \f[B]wait\f[R](2) .SH AUTHOR .PP Dotan Barak