bcopy()
Hi Linus,
The implementation of bcopy() in lib/string.c (and some other places such as the XFS header files) is incorrect as it implements bcopy as memcpy. This is
wrong: bcopy should be the equivalent of memmove (which handles overlapping areas correctly).
I've dicussed it with a number of people, and the general consensus seems to be that it should be nuked entirely? Do you agree?
David
Quoted 7 lines · David Howells
Hi Linus,
The implementation of
bcopy()inlib/string.c(and some other places such as the XFS header files) is incorrect as it implements bcopy as memcpy. This is
wrong: bcopy should be the equivalent of memmove (which handles overlapping areas correctly).
Kernel bcopy in traditional unix versions never supported overlapping. That's what ovbcopy() is/was for.
Quoted 3 lines · David Howells
I've dicussed it with a number of people, and the general consensus seems to be that it should be nuked entirely? Do you agree?
I agree. bcopy should just DIE. Some architectures may have historical trouble with gcc emitting bcopy for structure assignments (and that's definitely a memcpy with no overlap), but I think that's long gone (I know gcc on alpha used to do this several years ago).
XFS seems to be a big user of bcopy, though..
Linus