This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I'd like to guarantee that what I write to a sysfs file (specifically the /sys/class/gpio/export file) is sync'd to the actual file. The code I had initially opened the file with the `O_SYNC` flag, which I assumed did this. However, in another piece of code, I tried using `fsync()`, but it failed with EINVAL, and `man fsync` tells me:
EROFS, EINVAL
fd is bound to a special file which does not support synchronization
I've checked the code for possible operations on a sysfs file, and did not find any sort of `do_sync_write` or `do_fsync` functions.
So, does the `O_SYNC` flag have any effect when opening a sysfs file? Shouldn't open return an error code when trying to open a file that does not support sync read/write with O_SYNC?
Regards,
Guilherme