1 /* $OpenBSD: fflush.c,v 1.7 2009/10/22 01:23:16 guenther Exp $ */
3 * SPDX-License-Identifier: BSD-3-Clause
5 * Copyright (C) 1990, 1993
6 * The Regents of the University of California. All rights reserved.
8 * This code is derived from software contributed to Berkeley by
16 /* Flush a single file, or (if fp is NULL) all files. */
17 int ust_safe_fflush(LTTNG_UST_LFILE
*fp
)
22 // return (_fwalk(__sflush));
23 if ((fp
->_flags
& (__SWR
| __SRW
)) == 0) {
27 return (__sflush(fp
));
31 __sflush(LTTNG_UST_LFILE
*fp
)
40 if ((p
= fp
->_bf
._base
) == NULL
)
43 n
= fp
->_p
- p
; /* write this much */
46 * Set these immediately to avoid problems with longjmp and to allow
47 * exchange buffering (via setvbuf) in user write function.
50 fp
->_w
= t
& (__SLBF
|__SNBF
) ? 0 : fp
->_bf
._size
;
52 for (; n
> 0; n
-= t
, p
+= t
) {
53 t
= (*fp
->_write
)(fp
->_cookie
, (char *)p
, n
);
This page took 0.039543 seconds and 4 git commands to generate.