diff options
author | Lakshmipathi <lakshmipathi.g@gmail.com> | 2011-07-08 11:51:53 +0530 |
---|---|---|
committer | Lakshmipathi <lakshmipathi.g@gmail.com> | 2011-07-08 11:51:53 +0530 |
commit | b47528cc4bb7a308c74d4dae7c2adcf9f7392f4e (patch) | |
tree | 35742effa1325ea42a99492167d16e75feabd373 /community-scripts/rename/atomic/reader.c | |
parent | bb2ca55002b8faac2b4687a97b611724081e601b (diff) |
Added community provided scripts for lock and rename
Diffstat (limited to 'community-scripts/rename/atomic/reader.c')
-rw-r--r-- | community-scripts/rename/atomic/reader.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/community-scripts/rename/atomic/reader.c b/community-scripts/rename/atomic/reader.c new file mode 100644 index 0000000..d25d9d8 --- /dev/null +++ b/community-scripts/rename/atomic/reader.c @@ -0,0 +1,23 @@ +/*
+ gcc reader.c -o reader -Wall
+*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+int main(void)
+{
+ int fd;
+
+ for (;;) {
+ usleep(rand() % 1000);
+ fd = open("dovecot.index", O_RDONLY);
+ if (fd == -1) {
+ perror("open(dovecot.index)");
+ break;
+ }
+ close(fd);
+ }
+ return 0;
+}
|