#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <dirent.h>
#include "ibverbs.h"
return 0;
}
+static void check_memlock_limit(void)
+{
+ struct rlimit rlim;
+
+ if (getrlimit(RLIMIT_MEMLOCK, &rlim)) {
+ fprintf(stderr, PFX "Warning: getrlimit(RLIMIT_MEMLOCK) failed.");
+ return;
+ }
+
+ if (rlim.rlim_cur <= 32768)
+ fprintf(stderr, PFX "Warning: RLIMIT_MEMLOCK is %lu bytes.\n"
+ " This will severely limit memory registrations.",
+ rlim.rlim_cur);
+}
+
static void add_device(struct ibv_device *dev,
struct ibv_device ***dev_list,
int *num_devices,
if (check_abi_version(sysfs_path))
return 0;
+ check_memlock_limit();
+
read_config();
find_sysfs_devs();