]>
Commit | Line | Data |
---|---|---|
3d9156a7 A |
1 | --- /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/findfp.c.orig 2004-05-22 08:19:41.000000000 -0700 |
2 | +++ /Volumes/XDisk/tmp/Libc/stdio/FreeBSD/findfp.c 2004-10-24 17:08:30.000000000 -0700 | |
9385eb3d A |
3 | @@ -47,6 +47,7 @@ |
4 | #include <stdlib.h> | |
5 | #include <string.h> | |
6 | ||
7 | +#include <pthread.h> | |
8 | #include <spinlock.h> | |
9 | ||
10 | #include "libc_private.h" | |
11 | @@ -62,12 +63,13 @@ | |
12 | {0}, __sFX + file} | |
13 | /* p r w flags file _bf z cookie close read seek write */ | |
14 | /* _ub _extra */ | |
15 | +#define __sFXInit {0, PTHREAD_MUTEX_INITIALIZER} | |
16 | /* the usual - (stdin + stdout + stderr) */ | |
17 | static FILE usual[FOPEN_MAX - 3]; | |
18 | static struct __sFILEX usual_extra[FOPEN_MAX - 3]; | |
19 | static struct glue uglue = { NULL, FOPEN_MAX - 3, usual }; | |
20 | ||
21 | -static struct __sFILEX __sFX[3]; | |
22 | +static struct __sFILEX __sFX[3] = {__sFXInit, __sFXInit, __sFXInit}; | |
23 | ||
24 | /* | |
25 | * We can't make this 'static' until 6.0-current due to binary | |
59e0d9fe | 26 | @@ -113,7 +115,7 @@ |
9385eb3d A |
27 | { |
28 | struct glue *g; | |
29 | static FILE empty; | |
30 | - static struct __sFILEX emptyx; | |
31 | + static struct __sFILEX emptyx = __sFXInit; | |
32 | FILE *p; | |
33 | struct __sFILEX *fx; | |
34 | ||
59e0d9fe | 35 | @@ -179,6 +181,7 @@ |
9385eb3d A |
36 | fp->_lb._base = NULL; /* no line buffer */ |
37 | fp->_lb._size = 0; | |
38 | /* fp->_lock = NULL; */ /* once set always set (reused) */ | |
39 | + fp->_extra->fl_mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; | |
40 | fp->_extra->orientation = 0; | |
3d9156a7 A |
41 | memset(&fp->_extra->mbstate, 0, sizeof(mbstate_t)); |
42 | return (fp); |