Date: Sat, 16 Nov 1996 04:54:32 +1100 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, jgreco@brasil.moneng.mei.com, terry@lambert.org Cc: hackers@FreeBSD.ORG, jdp@polstra.com, scrappy@ki.net Subject: Re: Sockets question... Message-ID: <199611151754.EAA20990@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
I wrote: >... Short reads are possible even for >normal files because the read might be into a partially invalid >buffer. ffs_read() returns the blocks that are successfully >read instead of unwinding the read and returning an EFAULT error. >Example: > >--- >#include <stdio.h> >#include <stdlib.h> > >#define SIZE 0x10000 > >main() >{ > void *buf; > int n; > > > buf = malloc(0x10000); > n = read(0, buf, 0x10000); > printf("read %d\n", n); >} >--- > >This prints 65536 here. A watertight example can be probably be >constructed using mmap(). Oops, pass the pointy hat. This is a non-example since i forgot to increase the read size and forget to tell you to invoke it with /kernel as stdin. Increasing the read size to 0x20000 gives more interesting behaviour: on system 1 with 32MB RAM: the kernel panics with a double fault on system 2 with 8MB RAM: read returns -1. I have seen a similar panic for writing from a bad address like 0xfffffc00 but I couldn't duplicate the problem and I thought it had something to do with a fixed vm bug. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611151754.EAA20990>