aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-05-12 12:33:40 +0000
committerChristian Grothoff <christian@grothoff.org>2011-05-12 12:33:40 +0000
commit312fc9f812932fddf159006784e61d4536751214 (patch)
treec7798a9c4183ece6ce7c02919c26b24364bd351d
parentfe8256cd9784987c3055043a2aa7be4a8c0699c7 (diff)
downloadlibmicrohttpd-312fc9f812932fddf159006784e61d4536751214.tar.gz
libmicrohttpd-312fc9f812932fddf159006784e61d4536751214.zip
warn users about pitfall with 32-bit vs. 64-bit off_t
-rw-r--r--doc/microhttpd.texi22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/microhttpd.texi b/doc/microhttpd.texi
index f46b7e87..e498b9b3 100644
--- a/doc/microhttpd.texi
+++ b/doc/microhttpd.texi
@@ -1403,6 +1403,28 @@ Return @mynull{} on error (i.e. invalid arguments, out of memory).
1403@deftypefun {struct MHD_Response *} MHD_create_response_from_fd_at_offset (uint64_t size, int fd, off_t offset) 1403@deftypefun {struct MHD_Response *} MHD_create_response_from_fd_at_offset (uint64_t size, int fd, off_t offset)
1404Create a response object. The response object can be extended with 1404Create a response object. The response object can be extended with
1405header information and then it can be used any number of times. 1405header information and then it can be used any number of times.
1406Note that you need to be a bit careful about @code{off_t} when
1407writing this code. Depending on your platform, @mhd{} is likely
1408to have been compiled with support for 64-bit files. When you
1409compile your own application, you must make sure that @code{off_t}
1410is also a 64-bit value. If not, your compiler may pass a 32-bit
1411value as @code{off_t}, which will result in 32-bits of garbage.
1412
1413If you use the autotools, use the @code{AC_SYS_LARGEFILE} autoconf
1414macro and make sure to include the generated @file{config.h} file
1415before @file{microhttpd.h} to avoid problems. If you do not have a
1416build system and only want to run on a GNU/Linux system, you could
1417also use
1418@verbatim
1419#define _FILE_OFFSET_BITS 64
1420#include <sys/types.h>
1421#include <sys/stat.h>
1422#include <fcntl.h>
1423#include <microhttpd.h>
1424@end verbatim
1425to ensure 64-bit @code{off_t}. Note that if your operating system
1426does not support 64-bit files, @mhd{} will be compiled with a 32-bit
1427@code{off_t} (in which case the above would be wrong...).
1406 1428
1407@table @var 1429@table @var
1408@item size 1430@item size