summaryrefslogtreecommitdiff
path: root/userland/libc/stdio/fflush.c
blob: 8bfd16d876bbef1744ecb33a5769d6183defa728 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <errno.h>
#include <stdio.h>
#include <syscall.h>

// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html
int fflush(FILE *stream) {
  if (stream) {
    if (stream->fflush) {
      stream->fflush(stream);
      return 0;
    }
  }
  errno = ENXIO;
  return -1;
}