lkml.org 
[lkml]   [2003]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: seq_file and exporting dynamically allocated data
On Mon, Nov 17, 2003 at 09:42:09AM +0000, Tigran Aivazian wrote:
> Here are two files: simple.c kernel module and user.c user test program.
> If you (or anyone) believe it is possible to return more than a single
> page on a read(2) please change them accordingly and let me know.

> while (1) {
> len = read(fd, procs, MAXPROCS*PROCLEN);
> nproc = len/PROCLEN;

Broken userland code. You expect read() to return a multiple of PROCLEN,
for one thing. For another, you have (several lines below) a broken
loop termination logics.

EOF had been reached when read() returns 0. Until then read() returns
an arbitrary amount of bytes between 1 and 'size' argument. Since you
are using read(2) directly, use it correctly...
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.041 / U:1.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site