diff options
Diffstat (limited to 'src/stable/file.cpp')
-rw-r--r-- | src/stable/file.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/stable/file.cpp b/src/stable/file.cpp index 35933f1..a15f394 100644 --- a/src/stable/file.cpp +++ b/src/stable/file.cpp | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <errno.h> | 9 | #include <errno.h> |
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
11 | #include <sys/stat.h> | 11 | #include <sys/stat.h> |
12 | #include <sys/file.h> | ||
12 | #include <fcntl.h> | 13 | #include <fcntl.h> |
13 | #include <unistd.h> | 14 | #include <unistd.h> |
14 | #include <time.h> | 15 | #include <time.h> |
@@ -200,6 +201,21 @@ void Bu::File::setBlocking( bool bBlocking ) | |||
200 | #endif | 201 | #endif |
201 | } | 202 | } |
202 | 203 | ||
204 | bool Bu::File::canLock() const | ||
205 | { | ||
206 | return true; | ||
207 | } | ||
208 | |||
209 | void Bu::File::lock( bool bExclusive ) | ||
210 | { | ||
211 | ::flock( fd, bExclusive?LOCK_EX:LOCK_SH ); | ||
212 | } | ||
213 | |||
214 | void Bu::File::unlock() | ||
215 | { | ||
216 | ::flock( fd, LOCK_UN ); | ||
217 | } | ||
218 | |||
203 | Bu::File Bu::File::tempFile( Bu::String &sName ) | 219 | Bu::File Bu::File::tempFile( Bu::String &sName ) |
204 | { | 220 | { |
205 | int iXes; | 221 | int iXes; |