MT-Safe wrapper around memcpy()?

[ Available lists | Index of freebsd-hackers | Month of Oct 2001 | Week of 28 Oct 2001 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Lamont Granquist <lamont@scriptkiddie.org>
Date
28 Oct 2001 22:42:55
Subject
MT-Safe wrapper around memcpy()?
Message-ID
20011028223152.K5909-100000@coredump.scriptkiddie.org


[ Hide this part ]
 
I'm trying to figure out the best way to write a wrapper around memcpy()
which can call fprintf() without winding up getting into a recursive
loop. The problem is that fprintf() will call memcpy() and around and
around we go.

I can use a global variable to prevent this, but that usage isn't thread
safe. I can make it thread safe by using pthread keys, but then i have to
link in libc_r, and for non-pthreaded programs i don't want to do that.

Anyone have any suggestions? Right now I'm almost thinking that I just
need to directly patch libc and libc_r. It might be an ugly patch though,
and I'd rather not have this patch mandate recompiling all of libc.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Elapsed time: 0.439 seconds