sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Name : fdatasync.cpp
|
sl@0
|
15 |
// Part of : LIBC
|
sl@0
|
16 |
// Contains the source for fchdir
|
sl@0
|
17 |
// Version : 1.0
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <unistd.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
/*
|
sl@0
|
25 |
The fdatasync() function shall force all currently queued I/O operations associated
|
sl@0
|
26 |
with the file indicated by file descriptor fildes to the synchronized I/O completion
|
sl@0
|
27 |
state.The functionality shall be equivalent to fsync() with the symbol ->
|
sl@0
|
28 |
_POSIX_SYNCHRONIZED_IO defined, with the exception that all I/O operations shall be
|
sl@0
|
29 |
completed as defined for synchronized I/O data integrity completion.If successful,
|
sl@0
|
30 |
the fdatasync() function shall return the value 0; otherwise, the function shall
|
sl@0
|
31 |
return the value -1 and set errno to indicate the error.
|
sl@0
|
32 |
*/
|
sl@0
|
33 |
|
sl@0
|
34 |
extern "C" {
|
sl@0
|
35 |
|
sl@0
|
36 |
EXPORT_C int fdatasync(int filedesc)
|
sl@0
|
37 |
{
|
sl@0
|
38 |
int retVal = -1;
|
sl@0
|
39 |
#ifndef _POSIX_SYNCHRONIZED_IO
|
sl@0
|
40 |
#define _POSIX_SYNCHRONIZED_IO
|
sl@0
|
41 |
#define FLAG_FOR_FSYNC 1
|
sl@0
|
42 |
#endif
|
sl@0
|
43 |
//Calls fsync that provides equivalent functionality.
|
sl@0
|
44 |
retVal = fsync(filedesc);
|
sl@0
|
45 |
|
sl@0
|
46 |
#ifdef FLAG_FOR_FSYNC
|
sl@0
|
47 |
#undef _POSIX_SYNCHRONIZED_IO;
|
sl@0
|
48 |
#undef FLAG_FOR_FSYNC
|
sl@0
|
49 |
#endif
|
sl@0
|
50 |
|
sl@0
|
51 |
return retVal;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
} //extern "C"
|
sl@0
|
55 |
|