diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/system/flock.h | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/system/flock.h')
-rw-r--r-- | util/system/flock.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/util/system/flock.h b/util/system/flock.h new file mode 100644 index 0000000000..797b1970a1 --- /dev/null +++ b/util/system/flock.h @@ -0,0 +1,35 @@ +#pragma once + +#include "error.h" +#include "defaults.h" +#include "file.h" + +#if defined(_unix_) + + #include <sys/file.h> + #include <fcntl.h> + +static inline int Flock(int fd, int op) { + return flock(fd, op); +} + +#else // not _unix_ + + #ifdef __cplusplus +extern "C" { + #endif + + #define LOCK_SH 1 /* shared lock */ + #define LOCK_EX 2 /* exclusive lock */ + #define LOCK_NB 4 /* don't block when locking */ + #define LOCK_UN 8 /* unlock */ + + int Flock(void* hndl, int operation); + int flock(int fd, int operation); + int fsync(int fd); + + #ifdef __cplusplus +} + #endif + +#endif // not _unix_ |