Date: Fri, 26 Apr 2019 11:41:18 -0700 From: Mark Millard <marklmi@yahoo.com> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: Alan Somers <asomers@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: buf(9) woes: when does bcopy do nothing at all? Message-ID: <6CF6472E-1100-475D-987C-071E916D64E8@yahoo.com> In-Reply-To: <23438.1556267575@critter.freebsd.dk> References: <CAOtMX2gdw%2BeQQU_-DC%2BEgimbCyw6ynbX1haGLUmn1dApk4rMZw@mail.gmail.com> <23438.1556267575@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2019-Apr-26, at 01:32, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote: > -------- > In message = <CAOtMX2gdw+eQQU_-DC+EgimbCyw6ynbX1haGLUmn1dApk4rMZw@mail.gmail.com>, = Alan Somers writes: >=20 >> How is it possible that bcopy() doesn't affect its output array at = all? >=20 > That conclusion does not follow from your example: >=20 >> bcopy(cp, iov->iov_base, cnt); >> r =3D memcmp(cp, iov->iov_base, cnt); >> if (r) >> printf("uiomove: miscompare\n"); >=20 > If [cp:cp+cnt] and [iov_base:iov_base+cnt] overlap the bcopy result > is undefined. >=20 > Try memmove instead ? I only see a bcopy man page bcopy(3) but it says: DESCRIPTION The bcopy() function copies len bytes from string src to string = dst. The two strings may overlap. If len is zero, no bytes are copied. Is a kernel bcopy likely to be any different? =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6CF6472E-1100-475D-987C-071E916D64E8>