.\" Automatically generated by Pandoc 1.19.2.4
.\"
.TH "IBV_FORK_INIT" "3" "2006\-10\-31" "libibverbs" "Libibverbs Programmer\[aq]s Manual"
.hy
.SH NAME
.PP
ibv_fork_init \- initialize libibverbs to support fork()
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <infiniband/verbs.h>
int\ ibv_fork_init(void);
\f[]
.fi
.SH DESCRIPTION
.PP
\f[B]ibv_fork_init()\f[] initializes libibverbs\[aq]s data structures to
handle \f[B]fork()\f[] function calls correctly and avoid data
corruption, whether \f[B]fork()\f[] is called explicitly or implicitly
(such as in \f[B]system()\f[]).
.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[] operation.
.SH RETURN VALUE
.PP
\f[B]ibv_fork_init()\f[] 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[] works on Linux kernels supporting the
\f[B]MADV_DONTFORK\f[] flag for \f[B]madvise()\f[] (2.6.17 and higher).
.PP
Setting the environment variable \f[B]RDMAV_FORK_SAFE\f[] or
\f[B]IBV_FORK_SAFE\f[] has the same effect as calling
\f[B]ibv_fork_init()\f[].
.PP
Setting the environment variable \f[B]RDMAV_HUGEPAGES_SAFE\f[] 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[] 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[] adds further overhead to all
memory registrations.
.SH SEE ALSO
.PP
\f[B]exec\f[](3), \f[B]fork\f[](2), \f[B]ibv_get_device_list\f[](3),
\f[B]system\f[](3), \f[B]wait\f[](2)
.SH AUTHOR
.PP
Dotan Barak <dotanba@gmail.com>