diff options
author | David Robillard <d@drobilla.net> | 2011-12-11 21:37:05 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-11 21:37:05 +0000 |
commit | e08decb5992d6511e6896939a4cd9ad157831b78 (patch) | |
tree | 5c2cfb7089e7dca124840d703a71e3bff92f2ab1 /src/reader.c | |
parent | 6e4a3a9ea93155e74da4b00fd7cf1b88b2d08f5f (diff) | |
download | serd-e08decb5992d6511e6896939a4cd9ad157831b78.tar.gz serd-e08decb5992d6511e6896939a4cd9ad157831b78.tar.bz2 serd-e08decb5992d6511e6896939a4cd9ad157831b78.zip |
Use posix_fadvise to advise about sequential file access.
git-svn-id: http://svn.drobilla.net/serd/trunk@243 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/reader.c')
-rw-r--r-- | src/reader.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/reader.c b/src/reader.c index 42c5093f..68b5446d 100644 --- a/src/reader.c +++ b/src/reader.c @@ -25,6 +25,10 @@ #include <stdlib.h> #include <string.h> +#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO) +# include <fcntl.h> +#endif + #include "serd_internal.h" #include "serd-config.h" @@ -1485,7 +1489,6 @@ serd_reader_get_handle(const SerdReader* reader) { return reader->handle; } - SERD_API void serd_reader_add_blank_prefix(SerdReader* reader, @@ -1518,6 +1521,10 @@ serd_reader_read_file(SerdReader* reader, fprintf(stderr, "Error opening file %s (%s)\n", path, strerror(errno)); return SERD_ERR_UNKNOWN; } +#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO) + posix_fadvise(fileno(fd), 0, 0, POSIX_FADV_SEQUENTIAL); +#endif + SerdStatus ret = serd_reader_read_file_handle(reader, fd, path); fclose(fd); return ret; |