The HyperNews Linux KHG Discussion Pages

Question: Adding code to the Linux Kernel

Forum: The Linux Kernel Hackers' Guide
Date: Wed, 25 Mar 1998 18:04:48 GMT
From: <barry@skynet.csn.ul.ie>

Hi all,
       I am currently attempting my first kernel hack. I am adding code into the IP layer to randomly drop packets. 
I have two questions:

1) I want to be able to include a header file called random.h (usr/src/linux/include/net). This is so that I can generate random numbers. When I include this in my own C file, parse errors appear everywhere. Is this the right place to include this header file?

2) I would eventually like to get a random number generated based on seeding it from the current system time. This is so that I can get a new random number on each call to ip_input. Is there a way around not being able to include standard lib files in the kernel ( ie time.h, stdlib.h etc)?

Also it there any documentation on adding such modules to the kernel. It would greatly simplify my task.

Thanks

Patrick