[resend] memccpy() question

Jes Sorensen jes@trained-monkey.org
Tue Mar 25 09:57:00 GMT 2003


(resending from my subscribed email address)

Hi

I have a bug report regarding memccpy() on ia64 and I am not 100% sure
what is supposed to be correct behavior. SuS doesn't seem to be explicit
on this.

The problem is illustrated by the following simple code example:

    ptr = mmap(PAGE_SIZE)
    memccpy(dest, ptr, c, PAGE_SIZE+10)

The string pointed to by ptr contains the character c before the page
boundary. Now what happens is that the ia64 memccpy() implementation
uses software pipelining which does pretty hefty read-ahead and
therefore ends up hitting into the unmapped area before detecting the
character c.

My question is: Is it reasonable to say that memccpy() has a free go at
touching the entire source string as specified by the len argument or is
it valid to expect that you can specify a random length as long as the
character searched for is within the valid area?

Any thoughts?

Thanks,
Jes



More information about the Libc-hacker mailing list