Created
April 28, 2011 08:13
-
-
Save jonyesno/946001 to your computer and use it in GitHub Desktop.
Patch to build ddar on BSD / OS X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- scan.c.orig 2011-04-28 08:28:05.000000000 +0100 | |
+++ scan.c 2011-04-28 09:01:10.000000000 +0100 | |
@@ -38,6 +38,14 @@ | |
#define likely(x) __builtin_expect(x, 1) | |
#define unlikely(x) __builtin_expect(x, 0) | |
+#ifndef __linux__ | |
+#define TEMP_FAILURE_RETRY(expr) \ | |
+ ({ long int _res; \ | |
+ do _res = (long int) (expr); \ | |
+ while (_res == -1L && errno == EINTR); \ | |
+ _res; }) | |
+#endif | |
+ | |
struct scan_ctx { | |
/* The main read buffer itself */ | |
unsigned char *buffer[3]; | |
@@ -97,7 +105,9 @@ | |
int bytes_read; | |
bytes_read = retry_read(scan, scan->io_destination, scan->buffer_size / 3); | |
+#ifdef __linux__ | |
posix_fadvise(scan->fd, scan->source_offset, bytes_read, POSIX_FADV_DONTNEED); | |
+#endif | |
scan->source_offset += bytes_read; | |
scan->bytes_left += bytes_read; | |
} | |
@@ -147,7 +157,9 @@ | |
longjmp(scan->jmp_env, 1); | |
} | |
+#ifdef __linux__ | |
posix_fadvise(scan->fd, scan->source_offset, bytes_read, POSIX_FADV_DONTNEED); | |
+#endif | |
scan->source_offset += bytes_read; | |
scan->bytes_left += bytes_read; | |
} | |
--- setup.py.orig 2011-04-28 08:32:45.000000000 +0100 | |
+++ setup.py 2011-04-28 08:33:31.000000000 +0100 | |
@@ -12,7 +12,7 @@ | |
ext_modules=[ Extension('synctus._dds', ['scan.c', 'rabin.c', | |
'synctus/ddsmodule.c'], | |
include_dirs=['.'], | |
- libraries=['rt']) ], | |
+ ) ], | |
install_requires=['protobuf']) | |
# vim: set ts=8 sts=4 sw=4 ai et : | |
--- Makefile.orig 2011-04-28 09:27:25.000000000 +0100 | |
+++ Makefile 2011-04-28 09:27:31.000000000 +0100 | |
@@ -1,4 +1,4 @@ | |
-pydist: ddar.1 synctus/ddar_pb2.py | |
+pydist: synctus/ddar_pb2.py | |
sdist: pydist | |
python setup.py sdist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment