mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RE: How to get kernel data using /proc system?
@ 2002-03-01 23:47 Thomas Hood
  2002-03-02  1:54 ` Alexander Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Hood @ 2002-03-01 23:47 UTC (permalink / raw)
  To: linux-kernel

I wrote the following comment block explaining how 
to write a proc_file_read function.  This is the 
function you register with procfs using 
create_proc_read_entry().  Hope this helps. 
(This patch went into 2.5.x-djy)

[...] 
+			 * How to be a proc read function
+			 * ------------------------------
+			 * Prototype:
+			 *    int f(char *buffer, char **start, off_t offset,
+			 *          int count, int *peof, void *dat)
+			 *
+			 * Assume that the buffer is "count" bytes in size.
+			 *
+			 * If you know you have supplied all the data you
+			 * have, set *peof.
+			 *
+			 * You have three ways to return data:
+			 * 0) Leave *start = NULL.  (This is the default.)
+			 *    Put the data of the requested offset at that
+			 *    offset within the buffer.  Return the number (n)
+			 *    of bytes there are from the beginning of the
+			 *    buffer up to the last byte of data.  If the
+			 *    number of supplied bytes (= n - offset) is 
+			 *    greater than zero and you didn't signal eof
+			 *    and the reader is prepared to take more data
+			 *    you will be called again with the requested
+			 *    offset advanced by the number of bytes 
+			 *    absorbed.  This interface is useful for files
+			 *    no larger than the buffer.
+			 * 1) Set *start = an unsigned long value less than
+			 *    the buffer address but greater than zero.
+			 *    Put the data of the requested offset at the
+			 *    beginning of the buffer.  Return the number of
+			 *    bytes of data placed there.  If this number is
+			 *    greater than zero and you didn't signal eof
+			 *    and the reader is prepared to take more data
+			 *    you will be called again with the requested
+			 *    offset advanced by *start.  This interface is
+			 *    useful when you have a large file consisting
+			 *    of a series of blocks which you want to count
+			 *    and return as wholes.
+			 *    (Hack by Paul.Russell@rustcorp.com.au)
+			 * 2) Set *start = an address within the buffer.
+			 *    Put the data of the requested offset at *start.
+			 *    Return the number of bytes of data placed there.
+			 *    If this number is greater than zero and you
+			 *    didn't signal eof and the reader is prepared to
+			 *    take more data you will be called again with the
+			 *    requested offset advanced by the number of bytes
+			 *    absorbed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: How to get kernel data using /proc system?
  2002-03-01 23:47 How to get kernel data using /proc system? Thomas Hood
@ 2002-03-02  1:54 ` Alexander Viro
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Viro @ 2002-03-02  1:54 UTC (permalink / raw)
  To: Thomas Hood; +Cc: linux-kernel



On 1 Mar 2002, Thomas Hood wrote:

> I wrote the following comment block explaining how 
> to write a proc_file_read function.  This is the 
> function you register with procfs using 
> create_proc_read_entry().  Hope this helps. 

[snip ~50 lines of comments]

You know, that's a wonderful explanation... of reasons for _not_ using
->proc_read().  If interface takes that much to document - it's crap.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: How to get kernel data using /proc system?
@ 2002-03-01 23:22 Chen, Kenneth W
  0 siblings, 0 replies; 4+ messages in thread
From: Chen, Kenneth W @ 2002-03-01 23:22 UTC (permalink / raw)
  To: 'Lei Wang', linux-kernel

Lookup the document directory in the latest kernel tree.
linux/Documentation/DocBook/procfs*


-----Original Message-----
From: Lei Wang [mailto:wangglei@cse1u.ICS.UCI.EDU]
Sent: Friday, March 01, 2002 2:48 PM
To: linux-kernel@vger.kernel.org
Subject: How to get kernel data using /proc system?


Hello, everyone, could anybody help me out of this? Any help would be
highly appreciated. Thanks!

I want to read out some kernel data. But I searched the web a lot and
all the methods I found in using /proc filesystem seem to be out of
date. Does anybody know how to do this in Linux 2.4 or 2.2? 

Also, are other ways to get access to kernel data than using
/proc?

Thanks a lot!


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* How to get kernel data using /proc system?
  2002-03-01 22:35 [PATCH] spinlock not locked when unlocking in atm_dev_register Robert Love
@ 2002-03-01 22:48 ` Lei Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Lei Wang @ 2002-03-01 22:48 UTC (permalink / raw)
  To: linux-kernel

Hello, everyone, could anybody help me out of this? Any help would be
highly appreciated. Thanks!

I want to read out some kernel data. But I searched the web a lot and
all the methods I found in using /proc filesystem seem to be out of
date. Does anybody know how to do this in Linux 2.4 or 2.2? 

Also, are other ways to get access to kernel data than using
/proc?

Thanks a lot!



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-02  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-01 23:47 How to get kernel data using /proc system? Thomas Hood
2002-03-02  1:54 ` Alexander Viro
  -- strict thread matches above, loose matches on Subject: below --
2002-03-01 23:22 Chen, Kenneth W
2002-03-01 22:35 [PATCH] spinlock not locked when unlocking in atm_dev_register Robert Love
2002-03-01 22:48 ` How to get kernel data using /proc system? Lei Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®