Re: create_proc_info_entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/31/07, Thomas De Schampheleire <patrickdepinguin@xxxxxxxxx> wrote:
IIRC (didn't look this up recently and it's been a while), the return
value should be the number of characters actually written, so the
caller (the reader of your proc entry) knows whether an error occurs,
or how long the buffer is.

In order to write 17, you should use something like
int len;
int size = 17;
len = snprintf(buffer, sizeof(int), "%d", size)
return len;

I think in order to be correct, you should also handle the offset and
start values correctly.

Thanks.  I see how that works now.

Now I'm having trouble getting a random number.  I found
get_random_int() in linux/random.h but when I call it I get:

WARNING: "get_random_int" [/usr/src/simple/mymodule.ko] undefined!

I am including the header like this:

#include <linux/random.h>

Do I have to do something special because it's in a module?


--
Greg Donald
http://destiney.com/

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux