error handling for non-loaded module
This commit is contained in:
parent
c80333a19f
commit
c73b587078
1 changed files with 9 additions and 2 deletions
11
code/leak.c
11
code/leak.c
|
@ -9,9 +9,10 @@
|
|||
|
||||
#include "pipe_utils.c"
|
||||
|
||||
#define LKM_DEVICE "/dev/lkm"
|
||||
|
||||
// where does this come from?
|
||||
#define OBJS_PER_SLAB 42
|
||||
|
||||
#define PIPE_BUFFER (OBJS_PER_SLAB * 10)
|
||||
|
||||
int pipes[PIPE_BUFFER][2];
|
||||
|
@ -20,9 +21,15 @@ int
|
|||
main(void)
|
||||
{
|
||||
printf("main: start\n");
|
||||
FILE *device = fopen("/dev/lkm", "r+");
|
||||
FILE *device = fopen(LKM_DEVICE, "r+");
|
||||
|
||||
printf("main: fopen: %p\n", device);
|
||||
if (!device) {
|
||||
printf(
|
||||
"main: fopen: Error opening %s. Make sure the kernel module is loaded\n",
|
||||
LKM_DEVICE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("main: draining lower page free lists: %u objects\n",
|
||||
PIPE_BUFFER);
|
||||
|
|
Loading…
Add table
Reference in a new issue