4.104.114.84.95
Last change
on this file since 690861c was
65fd5ae,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/13/03 at 03:47:05
|
2003-09-13 Ralf Corsepius <corsepiu@…>
- src/sync.c: Don't undef STRICT_ANSI.
Use struct _reent (struct reent doesn't exist)
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * sync() - XXX ??? where is this defined |
---|
3 | * |
---|
4 | * This function operates by as follows: |
---|
5 | * for all threads |
---|
6 | * for all FILE * |
---|
7 | * fsync() |
---|
8 | * fdatasync() |
---|
9 | * |
---|
10 | * COPYRIGHT (c) 1989-2003. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #if HAVE_CONFIG_H |
---|
21 | #include "config.h" |
---|
22 | #endif |
---|
23 | |
---|
24 | #include <unistd.h> |
---|
25 | #include <stdio.h> |
---|
26 | |
---|
27 | #include <rtems.h> |
---|
28 | /* |
---|
29 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
30 | |
---|
31 | #include <rtems/libio_.h> |
---|
32 | #include <rtems/seterr.h> |
---|
33 | */ |
---|
34 | |
---|
35 | /* XXX check standards -- Linux version appears to be void */ |
---|
36 | void _fwalk(struct _reent *, void *); |
---|
37 | |
---|
38 | static void sync_wrapper(FILE *f) |
---|
39 | { |
---|
40 | int fn = fileno(f); |
---|
41 | |
---|
42 | fsync(fn); |
---|
43 | fdatasync(fn); |
---|
44 | } |
---|
45 | |
---|
46 | /* iterate over all FILE *'s for this thread */ |
---|
47 | static void sync_per_thread(Thread_Control *t) |
---|
48 | { |
---|
49 | struct _reent *current_reent; |
---|
50 | |
---|
51 | /* |
---|
52 | * The sync_wrapper() function will operate on the current thread's |
---|
53 | * reent structure so we will temporarily use that. |
---|
54 | */ |
---|
55 | current_reent = _Thread_Executing->libc_reent; |
---|
56 | _Thread_Executing->libc_reent = t->libc_reent; |
---|
57 | _fwalk (t->libc_reent, sync_wrapper); |
---|
58 | _Thread_Executing->libc_reent = current_reent; |
---|
59 | } |
---|
60 | |
---|
61 | int sync(void) |
---|
62 | { |
---|
63 | rtems_iterate_over_all_threads(sync_per_thread); |
---|
64 | return 0; |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.