Skip to contentSkip to conversation

bcopy()

DISCUSSION David Howells 3 participants 3 messages Oct 7, 2002

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 7 lines · David Howells

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).

Kernel bcopy in traditional unix versions never supported overlapping. That's what ovbcopy() is/was for.

#2 lore raw
In reply to David Howells
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