Skip to content

Commit fe0f9f9

Browse files
committedNov 24, 2016
pciutils: fixup finding modules to libkmod's way
Fixes #20683. (cherry picked from commit ceda8cb) It seems safe enough to unify the behavior with libkmod, especially on nixos.
1 parent ee52e98 commit fe0f9f9

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
 

Diff for: ‎pkgs/tools/system/pciutils/default.nix

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
88
sha256 = "0byl2f897w5lhs4bvr6p7qwcz9bllj2zyfv7nywbcbsnb9ha9wrb";
99
};
1010

11+
patches = [ ./module-dir.diff ];
12+
1113
buildInputs = [ pkgconfig zlib kmod which ];
1214

1315
makeFlags = "SHARED=yes PREFIX=\${out}";

Diff for: ‎pkgs/tools/system/pciutils/module-dir.diff

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Don't override libkmod's way of finding modules.
2+
3+
(We override that behavior in nixpkgs to fit nixos.)
4+
5+
diff --git a/ls-kernel.c b/ls-kernel.c
6+
index 78b70f1..ecacd0e 100644
7+
--- a/ls-kernel.c
8+
+++ b/ls-kernel.c
9+
@@ -29,13 +29,7 @@ show_kernel_init(void)
10+
if (show_kernel_inited >= 0)
11+
return show_kernel_inited;
12+
13+
- struct utsname uts;
14+
- if (uname(&uts) < 0)
15+
- die("uname() failed: %m");
16+
- char *name = alloca(64 + strlen(uts.release));
17+
- sprintf(name, "/lib/modules/%s", uts.release);
18+
-
19+
- kmod_ctx = kmod_new(name, NULL);
20+
+ kmod_ctx = kmod_new(NULL, NULL);
21+
if (!kmod_ctx)
22+
{
23+
fprintf(stderr, "lspci: Unable to initialize libkmod context\n");

0 commit comments

Comments
 (0)
Please sign in to comment.