📄 aio_fsync.3
字号:
.TH aio_fsync 3 2002-09-12 "Linux 2.4" Linux AIO".SH NAMEaio_fsync \- Synchronize a file's complete in-core state with that on disk.SH SYNOPSYS.nf.B #include <errno.h>.sp.br .B #include <aio.h>.sp.br.BI "int aio_fsync (int op, struct aiocb aiocbp)".fi.SH DESCRIPTION.PPWhen dealing with asynchronous operations it is sometimes necessary toget into a consistent state. This would mean for AIO that one wants toknow whether a certain request or a group of request were processed.This could be done by waiting for the notification sent by the systemafter the operation terminated, but this sometimes would mean wastingresources (mainly computation time). Instead POSIX.1b defines twofunctions which will help with most kinds of consistency..PPThe.IR aio_fsyncand .IR "aio_fsync64"functions are only availableif the symbol .IR "_POSIX_SYNCHRONIZED_IO"is defined in .I unistd.h.Calling this function forces all I/O operations operating queued at thetime of the function call operating on the file descriptor.IR "aiocbp->aio_fildes"into the synchronized I/O completion state . The .IR "aio_fsync"function returnsimmediately but the notification through the method described in.IR "aiocbp->aio_sigevent"will happen only after all requests for thisfile descriptor have terminated and the file is synchronized. This alsomeans that requests for this very same file descriptor which are queuedafter the synchronization request are not affected.If .IR "op"is .IR "O_DSYNC"the synchronization happens as with a callto .IR "fdatasync". Otherwise .IR "op"should be .IR "O_SYNC"andthe synchronization happens as with .IR "fsync".As long as the synchronization has not happened, a call to.IR "aio_error"with the reference to the object pointed to by.IR "aiocbp"returns .IR "EINPROGRESS". Once the synchronization isdone .IR "aio_error"return .IR 0if the synchronization was notsuccessful. Otherwise the value returned is the value to which the.IR "fsync"or .IR "fdatasync"function would have set the.IR "errno"variable. In this case nothing can be assumed about theconsistency for the data written to this file descriptor..SH "RETURN VALUES"The return value of this function is .IR 0if the request wassuccessfully enqueued. Otherwise the return value is .IR -1and.IR "errno"..SH ERRORS.TP.B EAGAINThe request could not be enqueued due to temporary lack of resources..TP.B EBADFThe file descriptor .IR "aiocbp->aio_fildes"is not valid or not openfor writing..TP.B EINVALThe implementation does not support I/O synchronization or the .IR "op"parameter is other than .IR "O_DSYNC"and .IR "O_SYNC"..TP.B ENOSYSThis function is not implemented..PPWhen the sources are compiled with .IR "_FILE_OFFSET_BITS == 64" thisfunction is in fact .IR "aio_return64"since the LFS interfacetransparently replaces the normal implementation..SH "SEE ALSO".BR aio(3),.BR aio_cancel(3),.BR aio_cancel64(3),.BR aio_error(3),.BR aio_error64(3),.BR aio_fsync64(3),.BR aio_init(3),.BR aio_read(3),.BR aio_read64(3),.BR aio_return(3),.BR aio_return64(3),.BR aio_suspend(3),.BR aio_suspend64(3),.BR aio_write(3),.BR aio_write64(3),.BR errno(3),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -