aio_fsync(3)
β¨ aio_fsync(3) β¨
okay bestie, so you're deep in the librt corner of the library (that's the real-time library, -lrt, keep it π
) and this is the Library Functions Manual page for aio_fsync. it's giving asynchronous file sync, it's giving "yes i queued your write, no i did not wait for it." let's get into it π¦
πΈ NAME πΈ
aio_fsync β asynchronous file synchronization. that's it, that's the whole vibe β¨
π LIBRARY π
the real-time library, aka librt, and you link it like this:
-lrt
that's the one, no cap π«Ά
π₯ SYNOPSIS π₯
#include <aio.h>
int aio_fsync(int op, struct aiocb *aiocbp);
so two args, op and a pointer to a struct aiocb called aiocbp. she's simple like that π
π DESCRIPTION π
so aio_fsync() does a sync on all the outstanding asynchronous I/O operations that are associated with aiocbp->aio_fildes. and if you're like "wait what even is the aiocb structure," go read aio(7), it has the whole description, i'm not doing that to you here π«Ά
more precisely (because apparently we're being precise now, okay, periodt):
- if
opisO_SYNC, then all currently queued I/O operations shall be completed as if by a call offsync(2) - if
opisO_DSYNC, this call is the asynchronous analog offdatasync(2)
and here's the thing bestie β this is a request only; it does not wait for I/O completion. so don't be out here assuming it finished, because it did not, it just put in the request like a text message you send and immediately put your phone down β¨
apart from aio_fildes, the only field in the structure pointed to by aiocbp that this call uses is the aio_sigevent field β that's a sigevent structure, described over in sigevent(3type) β and it tells you what kind of asynchronous notification you want at completion. every other field? ignored. not used. not read. don't @ me π
π RETURN VALUE π
- on success β meaning the sync request was successfully queued β this function returns
0π - on error it returns
-1, anderrnogets set to tell you what went wrong
π©· ERRORS π©·
like, the whole errno roster:
EAGAINβ out of resources. she's tapped out, no more to give πEBADFβaio_fildesis not a valid file descriptor open for writingEINVALβ synchronized I/O is not supported for this file, oropis notO_SYNCorO_DSYNCENOSYSβaio_fsync()is not implemented π
π¦ ATTRIBUTES π¦
for the whole explanation of what these terms even mean, go check out attributes(7). here's the rundown:
aio_fsync()β Thread safety:MT-Safeπ₯
MT-Safe means she's safe to call from multiple threads, slay π
β STANDARDS β
POSIX.1-2008. that's the standard she follows, periodt β¨
π HISTORY π
glibc 2.1POSIX.1-2001
so she's been around a minute, an icon honestly π
π SEE ALSO π
go get your read on, bestie:
aio_cancel(3)aio_error(3)aio_read(3)aio_return(3)aio_suspend(3)aio_write(3)lio_listio(3)aio(7)sigevent(3type)
and that's the page!! this came to you from Linux man-pages 6.20, dated 2026-02-08, and honestly that's such a cute little timestamp. stay async, stay synced, queue your requests and don't wait around for them π«Άπβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- Copyright 2003, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms