- Aug 08, 2020
-
-
Ahmed Abd El Mawgood authored
struct flock is posix defined locking mechanism on *nix platform Example usage (copied from https://gavv.github.io/articles/file-locks/) : #include <fcntl.h> struct flock fl; memset(&fl, 0, sizeof(fl)); // lock in shared mode fl.l_type = F_RDLCK; // lock entire file fl.l_whence = SEEK_SET; // offset base is start of the file fl.l_start = 0; // starting offset is zero fl.l_len = 0; // len is zero, which is a special value representing end // of file (no matter how large the file grows in future) fl.l_pid = 0; // F_SETLK(W) ignores it; F_OFD_SETLK(W) requires it to be zero // F_SETLKW specifies blocking mode if (fcntl(fd, F_SETLKW, &fl) == -1) { exit(1); } // atomically upgrade shared lock to exclusive lock, but only // for bytes in range [10; 15) // // after this call, the process will hold three lock regions: // [0; 10) - shared lock // [10; 15) - exclusive lock // [15; SEEK_END) - shared lock fl.l_type = F_WRLCK; fl.l_start = 10; fl.l_len = 5; // F_SETLKW specifies non-blocking mode if (fcntl(fd, F_SETLK, &fl) == -1) { exit(1); } // release lock for bytes in range [10; 15) fl.l_type = F_UNLCK; if (fcntl(fd, F_SETLK, &fl) == -1) { exit(1); } // close file and release locks for all regions // remember that locks are released when process calls close() // on any descriptor for a lock file close(fd);
-
- Aug 04, 2019
- Feb 22, 2019
-
-
Jeremy Soller authored
-
- Dec 02, 2018
-
-
Jeremy Soller authored
-
- Aug 27, 2018
-
-
Jeremy Soller authored
-
Jeremy Soller authored
-
- Aug 26, 2018
-
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
-
- Aug 25, 2018
-
-
Jeremy Soller authored
-
- Mar 15, 2018
-
-
Tom Almeida authored
-
Dan Robertson authored
Update cbindgen to parse modules with a path attribute and revert the following commits: - 996fad70. - cfe98ab3.
-
- Mar 14, 2018
-
-
Jeremy Soller authored
-
- Mar 09, 2018
-
-
SamwiseFilmore authored
-
Dan Robertson authored
The current implementation of open requires the user to pass all three args to the function. It should use a va_list and allow a user to provide only the filename and flags.
-
SamwiseFilmore authored
No tests written yet! See #36
-
- Mar 07, 2018
-
-
- Add cfg to extern crate sc. It is not used by redox. - Fix bad syntax in brk implementation for redox - nits - style: update brk implementation for linux - style: no space between not operator and ptr.is_null - style: should be a space around = in module path
-
- Mar 04, 2018
-
-
Jeremy Soller authored
-
- Mar 03, 2018
-
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
-
Jeremy Soller authored
-