Is there a way to tell if a process opened a file with the O_SYNC flag? I'm thinking lsof might be able to do this, but cannot find a way.
Is there a way to tell if a process opened a file with the O_SYNC flag? I'm thinking lsof might be able to do this, but cannot find a way.
This can be done using a
systemtap
script. This one has been taken from here, and does exactly what you want:Two examples on how to use it are provided in the referenced link, I'll reproduce one of them here:
You can replace
O_DIRECT
withO_SYNC
for your purpose.Further references:
# # # # # #
lsof +fg /path
will show flags used to open the file provide as a path. The short description of the flags returned can be found in man lsof.