summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/sync.c
blob: 0ea77422f1fbbdb8ce8977d61492154c53e75b8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
 * @file
 *
 * @ingroup libcsupport
 *
 * @brief This source file contains the implementation of sync().
 */

/*
 * Copyright (C) 2022 embedded brains GmbH
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <unistd.h>

#include <rtems/libio_.h>

void sync( void )
{
  int fd;

  for ( fd = 0; fd < (int) rtems_libio_number_iops; ++fd ) {
    (void) fsync( fd );
    (void) fdatasync( fd );
  }
}