Thread #108292753
HomeIndexCatalogAll ThreadsNew ThreadReply
H
previous: >>108285124

#define __NR_fsync                74
#define __NR_fdatasync 75

https://man7.org/linux/man-pages/man2/fsync.2.html

tl;dr:
flush file data to disk

the tl;dr honestly covers pretty much all of it for this one, lol. i guess it's maybe interesting that it blocks? plus the option for metadata-less flushes
i guess the one other thing worth mentioning is the EIO error case, where you can get some write-like errors when trying to flush
i'm sure these are useful to someone trying to do optimizations, but they're not something i've ever taken advantage of

relevant resources:
man man

man syscalls

https://man7.org/linux/man-pages/
https://linux.die.net/man/
https://elixir.bootlin.com/linux/
https://elixir.bootlin.com/musl/
https://elixir.bootlin.com/glibc/
+Showing all 14 replies.
>>
>>108292753
guess it can be useful for synchronization in some rare cases for network filesystems like NFS?
NFS by default uses async writes, data is flushed on close() of fsync(). Say you open a file and never close it. You continuously write to it on NFS client and expect to read it immediately on the server or another client, you could use fsync() for that.
Some shitty FUSE filesystems don't implement flush on fsync() (or even close() for that matter, muh "caching"), which leads to all sorts of synchronization issues (write and close a file, yet the changes aren't commited to the storage yet).
>>
bampu
>>
>>108292753
>pic
That's from the "OL has to wake up and go to work" set, right? Saucenao is garbage these days.
>>
Remember to do a sync everytime you do a dd, kids!
>>
Penis water tap lmao
>>
>>108292753
Bump.
>>
>>108294022
>dd
what's a dd?
>>
>>108296183
Dick Destroyer.
>>
>>108296183
It's the most based way to copy information. It is more commonly used to completely wipe hard drives, because if you type a command even slightly wrong, that's what you do.
>>
>>108292753
oh no why is shy crying
>>
>>108297413
i use it for formatting iso files onto USB drives
>>108293395
no idea sorry
>>108297465
because people don't post in her syscall threads :<
>>
bampu
>>
>>108297887
Just cp distro.iso /dev/sdb
dd is placebo
>>
>>108296183
demand draft
https://en.wikipedia.org/wiki/Demand_draft

Reply to Thread #108292753


Supported: JPG, PNG, GIF, WebP, WebM, MP4, MP3 (max 4MB)