UnifyFS icon indicating copy to clipboard operation
UnifyFS copied to clipboard

Create documentation page to list differences with posix

Open adammoody opened this issue 5 years ago • 1 comments

For POSIX calls where we differ from standard behavior, we should list those out.

As a first case, our truncate currently does not necessarily first sync a file:

fd = open(path, O_WRONLY | O_CREAT | O_TRUNC); // size = 0
write(fd, 1024)
// ftruncate will sync the given file descriptor before truncating
// so the write will happen and then the file will be truncated
ftruncate(fd, 0); // size = 0
fsync(fd);

However, truncate which takes a path does not fsync the file first:

fd = open(path, O_WRONLY | O_CREAT | O_TRUNC); // size = 0
write(fd, 1024)
truncate(path, 0);

// file at path may end up with size=1024 here,
// since data cached on file descriptor from write
// before truncate is sync'd after the file was truncated
fsync(fd);

adammoody avatar Jan 13 '20 20:01 adammoody

Also:

  1. chmod() and laminate details, including how we laminate files when we copy them in from a non-UnifyFS filesystem to /unifyfs.
  2. fsync() meaning in a UnifyFS sense
  3. stat() field oddities and "file size" meanings.

tonyhutter avatar Jan 13 '20 21:01 tonyhutter