help-hurd
[Top][All Lists]
Advanced

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

io_read() semantics


From: Ludovic Courtès
Subject: io_read() semantics
Date: Mon, 10 Jun 2002 14:45:15 +0200
User-agent: Mutt/1.2.5.1i

Hi,

I have a question about how io_read() should work, and I couldn't find the
answer in io.def. From what I've seen in libdiskfs/io-read.c , a diskfs server
is supposed to reallocate a new buffer if the provided buffer is smaller than
the requested amount of data:

  if (maxread > *datalen)
    {
      ourbuf = 1;
      buf = mmap (0, maxread, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);     
      *data = buf;
    }

Therefore, I would not expect io_read() to provide a new buffer with the
following code, since the buffer size if the same as the requested amount of
data (*len == size):

    void* d = data;

    size = (size > *len)?(*len):size;
    *len = size;
    err  = io_read (mbox, (data_t*)&data, len, start + offset, size);
    assert (data == d); // this assertion should not fail!

However, the last assertion does sometimes fail.

Any idea?

Thanks,
Ludovic.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]