Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,8 @@ if test "$enable_delayacct" = yes; then
AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
htop_config_cflags=`$PKG_CONFIG --cflags libnl-3.0 2>/dev/null`
AM_CFLAGS="$AM_CFLAGS $htop_config_cflags"
libdir_libnl=`$PKG_CONFIG --variable=libdir libnl-3.0 2>/dev/null`
AC_DEFINE_UNQUOTED([LIBDIR_LIBNL], ["$libdir_libnl"], [Path to the libnl-3 libraries])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um. A small question (maybe this is bike shedding).
Which name for the shell variable / C macro is better, LIBNL_LIBDIR or LIBDIR_LIBNL?

I would vote for LIBNL_LIBDIR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other places like for hwloc use FOO_LIBS, thus LIBNL_LIBDIR would be reasonable.

fi
AM_CONDITIONAL([HAVE_DELAYACCT], [test "$enable_delayacct" = yes])

Expand Down
8 changes: 4 additions & 4 deletions linux/LibNl.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ static int load_libnl(void) {
if (libnlHandle && libnlGenlHandle)
return 0;

libnlHandle = dlopen("libnl-3.so", RTLD_LAZY);
libnlHandle = dlopen(LIBDIR_LIBNL "/libnl-3.so", RTLD_LAZY);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a slash is used here unconditionally. Normally for libraries it's better to load them from default search paths rather than forcing a directory prefix at compile time. I know the directory is grabbed from pkg-config with this patch, but what if no directory prefix is specified there?

if (!libnlHandle) {
libnlHandle = dlopen("libnl-3.so.200", RTLD_LAZY);
libnlHandle = dlopen(LIBDIR_LIBNL "/libnl-3.so.200", RTLD_LAZY);
if (!libnlHandle) {
goto dlfailure;
}
}

libnlGenlHandle = dlopen("libnl-genl-3.so", RTLD_LAZY);
libnlGenlHandle = dlopen(LIBDIR_LIBNL "/libnl-genl-3.so", RTLD_LAZY);
if (!libnlGenlHandle) {
libnlGenlHandle = dlopen("libnl-genl-3.so.200", RTLD_LAZY);
libnlGenlHandle = dlopen(LIBDIR_LIBNL "/libnl-genl-3.so.200", RTLD_LAZY);
if (!libnlGenlHandle) {
goto dlfailure;
}
Expand Down