summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/local.h
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2005-12-16 02:50:53 +0000
committerdavidxu <davidxu@FreeBSD.org>2005-12-16 02:50:53 +0000
commitf2547368a8bf5177a138b8873c03912af57e90af (patch)
tree6ae4ec26d50bc59ff2d9306207a3b957bc977ae6 /lib/libc/stdio/local.h
parent1aa9ee553eae931f7025dd4707c9fd70d8789fbb (diff)
downloadFreeBSD-src-f2547368a8bf5177a138b8873c03912af57e90af.zip
FreeBSD-src-f2547368a8bf5177a138b8873c03912af57e90af.tar.gz
With current pthread implementations, a mutex initialization will
allocate a memory block. sscanf calls __svfscanf which in turn calls fread, fread triggers mutex initialization but the mutex is not destroyed in sscanf, this leads to memory leak. To avoid the memory leak and performance issue, we create a none MT-safe version of fread: __fread, and instead let __svfscanf call __fread. PR: threads/90392 Patch submitted by: dhartmei MFC after: 7 days
Diffstat (limited to 'lib/libc/stdio/local.h')
-rw-r--r--lib/libc/stdio/local.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h
index 74c3238..de038fa 100644
--- a/lib/libc/stdio/local.h
+++ b/lib/libc/stdio/local.h
@@ -78,7 +78,8 @@ extern int __vfscanf(FILE *, const char *, __va_list);
extern int __vfwprintf(FILE *, const wchar_t *, __va_list);
extern int __vfwscanf(FILE * __restrict, const wchar_t * __restrict,
__va_list);
-
+extern size_t __fread(void * __restrict buf, size_t size, size_t count,
+ FILE * __restrict fp);
extern int __sdidinit;
OpenPOWER on IntegriCloud