summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fflush.c
blob: b3fca8bd6e72b17841769683a7666d754fbe06c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "__stdio.h" // for __FILE, _IO_ERR
#include "stddef.h"  // for NULL

#include <atomic.h> // for LIBC_UNLOCK, LIBC_LOCK
#include <errno.h>  // for errno, EBADF, EIO
#include <stdio.h>

int fflush(struct __FILE *stream)
{
	int r;

	flockfile(stream);
	r = fflush_unlocked(stream);
	funlockfile(stream);

	return r;
}