Skip to content

Commit

Permalink
pciutils: fixup finding modules to libkmod's way
Browse files Browse the repository at this point in the history
Fixes #20683.

(cherry picked from commit ceda8cb)
It seems safe enough to unify the behavior with libkmod,
especially on nixos.
  • Loading branch information
vcunat committed Nov 24, 2016
1 parent ee52e98 commit fe0f9f9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkgs/tools/system/pciutils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "0byl2f897w5lhs4bvr6p7qwcz9bllj2zyfv7nywbcbsnb9ha9wrb";
};

patches = [ ./module-dir.diff ];

buildInputs = [ pkgconfig zlib kmod which ];

makeFlags = "SHARED=yes PREFIX=\${out}";
Expand Down
23 changes: 23 additions & 0 deletions pkgs/tools/system/pciutils/module-dir.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Don't override libkmod's way of finding modules.

(We override that behavior in nixpkgs to fit nixos.)

diff --git a/ls-kernel.c b/ls-kernel.c
index 78b70f1..ecacd0e 100644
--- a/ls-kernel.c
+++ b/ls-kernel.c
@@ -29,13 +29,7 @@ show_kernel_init(void)
if (show_kernel_inited >= 0)
return show_kernel_inited;

- struct utsname uts;
- if (uname(&uts) < 0)
- die("uname() failed: %m");
- char *name = alloca(64 + strlen(uts.release));
- sprintf(name, "/lib/modules/%s", uts.release);
-
- kmod_ctx = kmod_new(name, NULL);
+ kmod_ctx = kmod_new(NULL, NULL);
if (!kmod_ctx)
{
fprintf(stderr, "lspci: Unable to initialize libkmod context\n");

0 comments on commit fe0f9f9

Please sign in to comment.