[PATCH] off_t size problem

Simon Liu simohayha.bobo at gmail.com
Wed Nov 9 08:48:38 UTC 2011

Nginx define _FILE_OFFSET_BITS=64 in linux platform(ngx_linux_config.h),
and it will cause size of off_t is 8 byte. Therefore it should  include
nginx header file in starting position of other module(must be before
<sys/types.h>), otherwise off_t will be 4 byte(32 bit system) in the
module, this will be to cause some confusion .

I think use gcc -D will be better.

this is my patch:

Index: auto/os/linux
=================================================================== ---
auto/os/linux (revision 4267) +++ auto/os/linux (working copy) @@ -15,6
+15,9 @@ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" + + # Linux kernel version
version=$((`uname -r \ Index: src/os/unix/ngx_linux_config.h
=================================================================== ---
src/os/unix/ngx_linux_config.h (revision 4267) +++
src/os/unix/ngx_linux_config.h (working copy) @@ -12,7 +12,6 @@ #define
_GNU_SOURCE /* pread(), pwrite(), gethostname() */ #endif -#define
_FILE_OFFSET_BITS 64 #include <sys/types.h> #include <sys/time.h>


blog: www.pagefault.info

twitter: www.twitter.com/minibobo

weibo:  www.weibo.com/diaoliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20111109/c46c99f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: off.patch
Type: text/x-patch
Size: 726 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20111109/c46c99f0/attachment.bin>

More information about the nginx-devel mailing list