Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.arcetri.astro.it/irlab/doc/library/linux/khg/HyperNews/get/khg/234.html
Дата изменения: Thu Mar 23 12:37:55 2000
Дата индексирования: Wed Sep 15 00:51:53 2010
Кодировка:
Adding code to the Linux Kernel 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