source: rtems/cpukit/libcsupport/src/sync.c @ 8d54187

5
Last change on this file since 8d54187 was 8d54187, checked in by Sebastian Huber <sebastian.huber@…>, on 05/13/22 at 11:10:00

Synchronize all file descriptors in sync()

Synchronize all file descriptors and not just the ones associated with a FILE
object.

Close #4655.

  • Property mode set to 100644
File size: 574 bytes
Line 
1/**
2 * @file
3 *
4 * @ingroup libcsupport
5 *
6 * @brief This source file contains the implementation of sync().
7 */
8
9/*
10 * Copyright (C) 2022 embedded brains GmbH
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <unistd.h>
22
23#include <rtems/libio_.h>
24
25void sync( void )
26{
27  int fd;
28
29  for ( fd = 0; fd < (int) rtems_libio_number_iops; ++fd ) {
30    (void) fsync( fd );
31    (void) fdatasync( fd );
32  }
33}
Note: See TracBrowser for help on using the repository browser.