source: trunk/packages/xen-common/xen-common/tools/libaio/man/io_fsync.3 @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 2.3 KB
Line 
1./" static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
2./" {
3./"     io_prep_fsync(iocb, fd);
4./"     io_set_callback(iocb, cb);
5./"     return io_submit(ctx, 1, &iocb);
6./" }
7.TH io_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
8.SH NAME
9io_fsync \- Synchronize a file's complete in-core state with that on disk
10.SH SYNOPSYS
11.nf
12.B #include <errno.h>
13.sp
14.br
15.B #include <libaio.h>
16.sp
17.br
18.BI "int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)"
19.sp
20struct iocb {
21        void            *data;
22        unsigned        key;
23        short           aio_lio_opcode;
24        short           aio_reqprio;
25        int             aio_fildes;
26};
27.sp
28typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2);
29.sp
30.fi
31.SH DESCRIPTION
32When dealing with asynchronous operations it is sometimes necessary to
33get into a consistent state.  This would mean for AIO that one wants to
34know whether a certain request or a group of request were processed.
35This could be done by waiting for the notification sent by the system
36after the operation terminated, but this sometimes would mean wasting
37resources (mainly computation time).
38.PP
39Calling this function forces all I/O operations operating queued at the
40time of the function call operating on the file descriptor
41.IR "iocb->io_fildes"
42into the synchronized I/O completion state .  The
43.IR "io_fsync"
44function returns
45immediately but the notification through the method described in
46.IR "io_callback"
47will happen only after all requests for this
48file descriptor have terminated and the file is synchronized.  This also
49means that requests for this very same file descriptor which are queued
50after the synchronization request are not affected.
51.SH "RETURN VALUES"
52Returns 0, otherwise returns errno.
53.SH ERRORS
54.TP
55.B EFAULT
56.I iocbs
57referenced data outside of the program's accessible address space.
58.TP
59.B EINVAL
60.I ctx
61refers to an unitialized aio context, the iocb pointed to by
62.I iocbs
63contains an improperly initialized iocb,
64.TP
65.B EBADF
66The iocb contains a file descriptor that does not exist.
67.TP
68.B EINVAL
69The file specified in the iocb does not support the given io operation.
70.SH "SEE ALSO"
71.BR io(3),
72.BR io_cancel(3),
73.BR io_getevents(3),
74.BR io_prep_pread(3),
75.BR io_prep_pwrite(3),
76.BR io_queue_init(3),
77.BR io_queue_release(3),
78.BR io_queue_run(3),
79.BR io_queue_wait(3),
80.BR io_set_callback(3),
81.BR io_submit(3),
82.BR errno(3)
Note: See TracBrowser for help on using the repository browser.