Rev 4921 | Rev 6536 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4921 | Rev 6099 | ||
---|---|---|---|
Line 36... | Line 36... | ||
36 | streams are closed during _reclaim_reent(). The stdin, stdout and stderr |
36 | streams are closed during _reclaim_reent(). The stdin, stdout and stderr |
37 | streams are initialized to use file descriptors 0, 1 and 2 respectively. In |
37 | streams are initialized to use file descriptors 0, 1 and 2 respectively. In |
38 | case _STDIO_CLOSE_PER_REENT_STD_STREAMS is defined these file descriptors |
38 | case _STDIO_CLOSE_PER_REENT_STD_STREAMS is defined these file descriptors |
39 | will be closed via close() provided the owner of the reent structure |
39 | will be closed via close() provided the owner of the reent structure |
40 | triggerd the on demand reent initilization, see CHECK_INIT(). */ |
40 | triggerd the on demand reent initilization, see CHECK_INIT(). */ |
41 | #ifndef __rtems__ |
41 | #if !defined(__rtems__) && !defined(__tirtos__) |
42 | #define _STDIO_CLOSE_PER_REENT_STD_STREAMS |
42 | #define _STDIO_CLOSE_PER_REENT_STD_STREAMS |
43 | #endif |
43 | #endif |
Line 44... | Line 44... | ||
44 | 44 | ||
45 | /* The following macros are supposed to replace calls to _flockfile/_funlockfile |
45 | /* The following macros are supposed to replace calls to _flockfile/_funlockfile |
Line 58... | Line 58... | ||
58 | #if !defined (__SINGLE_THREAD__) && defined (_POSIX_THREADS) \ |
58 | #if !defined (__SINGLE_THREAD__) && defined (_POSIX_THREADS) \ |
59 | && !defined (__rtems__) |
59 | && !defined (__rtems__) |
60 | #define _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
60 | #define _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
61 | #endif |
61 | #endif |
Line -... | Line 62... | ||
- | 62 | ||
- | 63 | #if defined(__SINGLE_THREAD__) || defined(__IMPL_UNLOCKED__) |
|
- | 64 | ||
- | 65 | # define _newlib_flockfile_start(_fp) |
|
- | 66 | # define _newlib_flockfile_exit(_fp) |
|
- | 67 | # define _newlib_flockfile_end(_fp) |
|
- | 68 | # define _newlib_sfp_lock_start() |
|
- | 69 | # define _newlib_sfp_lock_exit() |
|
- | 70 | # define _newlib_sfp_lock_end() |
|
62 | 71 | ||
63 | #ifdef _STDIO_WITH_THREAD_CANCELLATION_SUPPORT |
72 | #elif defined(_STDIO_WITH_THREAD_CANCELLATION_SUPPORT) |
Line 64... | Line 73... | ||
64 | #include |
73 | #include |
65 | 74 | ||
66 | /* Start a stream oriented critical section: */ |
75 | /* Start a stream oriented critical section: */ |
67 | # define _newlib_flockfile_start(_fp) \ |
76 | # define _newlib_flockfile_start(_fp) \ |
68 | { \ |
77 | { \ |
- | 78 | int __oldfpcancel; \ |
|
69 | int __oldfpcancel; \ |
79 | pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &__oldfpcancel); \ |
Line 70... | Line 80... | ||
70 | pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &__oldfpcancel); \ |
80 | if (!(_fp->_flags2 & __SNLK)) \ |
71 | _flockfile (_fp) |
81 | _flockfile (_fp) |
- | 82 | ||
72 | 83 | /* Exit from a stream oriented critical section prematurely: */ |
|
73 | /* Exit from a stream oriented critical section prematurely: */ |
84 | # define _newlib_flockfile_exit(_fp) \ |
Line 74... | Line 85... | ||
74 | # define _newlib_flockfile_exit(_fp) \ |
85 | if (!(_fp->_flags2 & __SNLK)) \ |
75 | _funlockfile (_fp); \ |
86 | _funlockfile (_fp); \ |
- | 87 | pthread_setcancelstate (__oldfpcancel, &__oldfpcancel); |
|
76 | pthread_setcancelstate (__oldfpcancel, &__oldfpcancel); |
88 | |
77 | 89 | /* End a stream oriented critical section: */ |
|
78 | /* End a stream oriented critical section: */ |
90 | # define _newlib_flockfile_end(_fp) \ |
Line 79... | Line 91... | ||
79 | # define _newlib_flockfile_end(_fp) \ |
91 | if (!(_fp->_flags2 & __SNLK)) \ |
Line 97... | Line 109... | ||
97 | # define _newlib_sfp_lock_end() \ |
109 | # define _newlib_sfp_lock_end() \ |
98 | __sfp_lock_release (); \ |
110 | __sfp_lock_release (); \ |
99 | pthread_setcancelstate (__oldsfpcancel, &__oldsfpcancel); \ |
111 | pthread_setcancelstate (__oldsfpcancel, &__oldsfpcancel); \ |
100 | } |
112 | } |
Line 101... | Line 113... | ||
101 | 113 | ||
Line 102... | Line 114... | ||
102 | #else /* !_STDIO_WITH_THREAD_CANCELLATION_SUPPORT */ |
114 | #else /* !__SINGLE_THREAD__ && !__IMPL_UNLOCKED__ && !_STDIO_WITH_THREAD_CANCELLATION_SUPPORT */ |
103 | 115 | ||
- | 116 | # define _newlib_flockfile_start(_fp) \ |
|
104 | # define _newlib_flockfile_start(_fp) \ |
117 | { \ |
Line 105... | Line 118... | ||
105 | { \ |
118 | if (!(_fp->_flags2 & __SNLK)) \ |
- | 119 | _flockfile (_fp) |
|
106 | _flockfile(_fp) |
120 | |
Line 107... | Line 121... | ||
107 | 121 | # define _newlib_flockfile_exit(_fp) \ |
|
- | 122 | if (!(_fp->_flags2 & __SNLK)) \ |
|
108 | # define _newlib_flockfile_exit(_fp) \ |
123 | _funlockfile(_fp); \ |
109 | _funlockfile(_fp); \ |
124 | |
Line 110... | Line 125... | ||
110 | 125 | # define _newlib_flockfile_end(_fp) \ |
|
111 | # define _newlib_flockfile_end(_fp) \ |
126 | if (!(_fp->_flags2 & __SNLK)) \ |
Line 121... | Line 136... | ||
121 | 136 | ||
122 | # define _newlib_sfp_lock_end() \ |
137 | # define _newlib_sfp_lock_end() \ |
123 | __sfp_lock_release (); \ |
138 | __sfp_lock_release (); \ |
Line 124... | Line 139... | ||
124 | } |
139 | } |
Line -... | Line 140... | ||
- | 140 | ||
- | 141 | #endif /* __SINGLE_THREAD__ || __IMPL_UNLOCKED__ */ |
|
125 | 142 | ||
126 | #endif /* _STDIO_WITH_THREAD_CANCELLATION_SUPPORT */ |
143 | extern wint_t _EXFUN(__fgetwc, (struct _reent *, FILE *)); |
127 | 144 | extern wint_t _EXFUN(__fputwc, (struct _reent *, wchar_t, FILE *)); |
|
128 | extern u_char *_EXFUN(__sccl, (char *, u_char *fmt)); |
145 | extern u_char *_EXFUN(__sccl, (char *, u_char *fmt)); |
129 | extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); |
146 | extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); |
Line 145... | Line 162... | ||
145 | int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, |
162 | int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, |
146 | va_list)); |
163 | va_list)); |
147 | extern FILE *_EXFUN(__sfp,(struct _reent *)); |
164 | extern FILE *_EXFUN(__sfp,(struct _reent *)); |
148 | extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); |
165 | extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); |
149 | extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); |
166 | extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); |
- | 167 | #ifdef _STDIO_BSD_SEMANTICS |
|
- | 168 | extern int _EXFUN(__sflushw_r,(struct _reent *,FILE *)); |
|
- | 169 | #endif |
|
150 | extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); |
170 | extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); |
151 | extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(struct _reent *, void *, char *, |
171 | extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(struct _reent *, void *, char *, |
152 | _READ_WRITE_BUFSIZE_TYPE)); |
172 | _READ_WRITE_BUFSIZE_TYPE)); |
153 | extern _READ_WRITE_RETURN_TYPE _EXFUN(__seofread,(struct _reent *, void *, |
173 | extern _READ_WRITE_RETURN_TYPE _EXFUN(__seofread,(struct _reent *, void *, |
154 | char *, |
174 | char *, |