Rev 4921 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4921 | Rev 6099 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
16 | */ |
16 | */ |
Line 17... | Line 17... | ||
17 | 17 | ||
18 | /* |
18 | /* |
19 | FUNCTION |
19 | FUNCTION |
Line 20... | Line 20... | ||
20 | < |
20 | < |
21 | 21 | ||
22 | INDEX |
22 | INDEX |
- | 23 | fflush |
|
- | 24 | INDEX |
|
23 | fflush |
25 | fflush_unlocked |
- | 26 | INDEX |
|
- | 27 | _fflush_r |
|
Line 24... | Line 28... | ||
24 | INDEX |
28 | INDEX |
25 | _fflush_r |
29 | _fflush_unlocked_r |
26 | 30 | ||
Line -... | Line 31... | ||
- | 31 | ANSI_SYNOPSIS |
|
- | 32 | #include |
|
- | 33 | int fflush(FILE *<[fp]>); |
|
- | 34 | ||
- | 35 | #define _BSD_SOURCE |
|
27 | ANSI_SYNOPSIS |
36 | #include |
Line -... | Line 37... | ||
- | 37 | int fflush_unlocked(FILE *<[fp]>); |
|
- | 38 | ||
- | 39 | #include |
|
- | 40 | int _fflush_r(struct _reent *<[reent]>, FILE *<[fp]>); |
|
28 | #include |
41 | |
29 | int fflush(FILE *<[fp]>); |
42 | #define _BSD_SOURCE |
30 | 43 | #include |
|
Line 31... | Line 44... | ||
31 | int _fflush_r(struct _reent *<[reent]>, FILE *<[fp]>); |
44 | int _fflush_unlocked_r(struct _reent *<[reent]>, FILE *<[fp]>); |
Line 43... | Line 56... | ||
43 | Additionally, if <[fp]> is a seekable input stream visiting a file |
56 | Additionally, if <[fp]> is a seekable input stream visiting a file |
44 | descriptor, set the position of the file descriptor to match next |
57 | descriptor, set the position of the file descriptor to match next |
45 | unread byte, useful for obeying POSIX semantics when ending a process |
58 | unread byte, useful for obeying POSIX semantics when ending a process |
46 | without consuming all input from the stream. |
59 | without consuming all input from the stream. |
Line -... | Line 60... | ||
- | 60 | ||
- | 61 | < |
|
- | 62 | < |
|
- | 63 | protected by flockfile() (or ftrylockfile()) and funlockfile(). This |
|
- | 64 | function may safely be used in a multi-threaded program if and only |
|
- | 65 | if they are called while the invoking thread owns the (FILE *) |
|
- | 66 | object, as is the case after a successful call to the flockfile() or |
|
- | 67 | ftrylockfile() functions. If threads are disabled, then |
|
- | 68 | < |
|
47 | 69 | ||
48 | The alternate function <<_fflush_r>> is a reentrant version, where the |
70 | The alternate functions <<_fflush_r>> and <<_fflush_unlocked_r>> are |
49 | extra argument <[reent]> is a pointer to a reentrancy structure, and |
71 | reentrant versions, where the extra argument <[reent]> is a pointer to |
Line 50... | Line 72... | ||
50 | <[fp]> must not be NULL. |
72 | a reentrancy structure, and <[fp]> must not be NULL. |
51 | 73 | ||
52 | RETURNS |
74 | RETURNS |
Line 53... | Line 75... | ||
53 | < |
75 | < |
54 | situation, it returns < |
76 | situation, it returns < |
55 | 77 | ||
Line -... | Line 78... | ||
- | 78 | PORTABILITY |
|
- | 79 | ANSI C requires < |
|
56 | PORTABILITY |
80 | specified by POSIX, and not all implementations follow POSIX rules. |
57 | ANSI C requires < |
81 | |
Line 58... | Line 82... | ||
58 | specified by POSIX, and not all implementations follow POSIX rules. |
82 | < |
59 | 83 | ||
60 | No supporting OS subroutines are required. |
84 | No supporting OS subroutines are required. |
61 | */ |
85 | */ |
Line -... | Line 86... | ||
- | 86 | ||
- | 87 | #include <_ansi.h> |
|
- | 88 | #include |
|
- | 89 | #include |
|
- | 90 | #include "local.h" |
|
- | 91 | ||
62 | 92 | #ifdef __IMPL_UNLOCKED__ |
|
Line 63... | Line 93... | ||
63 | #include <_ansi.h> |
93 | #define _fflush_r _fflush_unlocked_r |
64 | #include |
94 | #define fflush fflush_unlocked |
65 | #include |
95 | #endif |
Line 202... | Line 232... | ||
202 | n -= t; |
232 | n -= t; |
203 | } |
233 | } |
204 | return 0; |
234 | return 0; |
205 | } |
235 | } |
Line -... | Line 236... | ||
- | 236 | ||
- | 237 | #ifdef _STDIO_BSD_SEMANTICS |
|
- | 238 | /* Called from _cleanup_r. At exit time, we don't need file locking, |
|
- | 239 | and we don't want to move the underlying file pointer unless we're |
|
- | 240 | writing. */ |
|
- | 241 | int |
|
- | 242 | _DEFUN(__sflushw_r, (ptr, fp), |
|
- | 243 | struct _reent *ptr _AND |
|
- | 244 | register FILE *fp) |
|
- | 245 | { |
|
- | 246 | return (fp->_flags & __SWR) ? __sflush_r (ptr, fp) : 0; |
|
- | 247 | } |
|
- | 248 | #endif |
|
- | 249 | ||
- | 250 | #endif /* __IMPL_UNLOCKED__ */ |
|
206 | 251 | ||
207 | int |
252 | int |
208 | _DEFUN(_fflush_r, (ptr, fp), |
253 | _DEFUN(_fflush_r, (ptr, fp), |
209 | struct _reent *ptr _AND |
254 | struct _reent *ptr _AND |
210 | register FILE * fp) |
255 | register FILE * fp) |