lkml.org 
[lkml]   [1999]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsys_read broken for various /proc files

The Linux kernel when requested to read n bytes from a file from /proc
will ignore the request and stuff as many bytes as it feels like
stuffing.

I include a tests program:

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>

static char buffer [8];

main ()
{
int fd;

printf ("Before: [%s]\n", buffer);

fd = open ("/proc/locks", O_RDONLY);
if (fd == -1){
printf ("Can not open /proc/locks");
exit (1);
}
read (fd, buffer, 1);
read (fd, buffer, 1);
read (fd, buffer, 1);
read (fd, buffer, 1);
read (fd, buffer, 1);
read (fd, buffer, 1);
read (fd, buffer, 1);

printf ("Read: [%s]\n", buffer);
}


miguel.

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

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