source: rtems/cpukit/libcsupport/src/fdatasync.c @ baef823c

5
Last change on this file since baef823c was baef823c, checked in by Sebastian Huber <sebastian.huber@…>, on 09/13/17 at 07:22:19

libio: Add hold/drop iop reference

Check iop reference count in close() and return -1 with errno set to
EBUSY in case the file descriptor is still in use.

Update #3132.

  • Property mode set to 100644
File size: 770 bytes
Line 
1/**
2 * @file
3 *
4 * @brief POSIX 1003.1b 6.6.2 - Synchronize the Data of a File
5 * @ingroup libcsupport
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
10 *  On-Line Applications Research Corporation (OAR).
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <unistd.h>
22
23#include <rtems/libio_.h>
24#include <rtems/seterr.h>
25
26int fdatasync(
27  int     fd
28)
29{
30  rtems_libio_t *iop;
31  int            rv;
32
33  LIBIO_GET_IOP_WITH_ACCESS( fd, iop, LIBIO_FLAGS_WRITE, EBADF );
34
35  /*
36   *  Now process the fdatasync().
37   */
38
39  rv = (*iop->pathinfo.handlers->fdatasync_h)( iop );
40  rtems_libio_iop_drop( iop );
41  return rv;
42}
Note: See TracBrowser for help on using the repository browser.