Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2011 18:12:10 GMT
From:      Mark Atkinson <atkin901@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/162446: [ports] nginx is confused with new posix_fadvise
Message-ID:  <201111101812.pAAICAZm040858@red.freebsd.org>
Resent-Message-ID: <201111101820.pAAIK8Dv088699@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         162446
>Category:       ports
>Synopsis:       [ports] nginx is confused with new posix_fadvise
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 10 18:20:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Mark Atkinson
>Release:        10.0-CURRENT
>Organization:
>Environment:
10.0-CURRENT #23 r227391: Wed Nov  9 09:53:56 PST 2011
>Description:
nginx is confused with the introduction of posix_fadvise to the system. 

In src/os/unix/ngx_files.h there is an attempt to define ngx_read_ahead() to fcntl which breaks compilation of ngx_files.c when fcntl is attempted to be reassigned back to a real function.

ngx_files.h:
    275 #if (NGX_HAVE_F_READAHEAD)
    276 
    277 #define NGX_HAVE_READ_AHEAD      1
    278 
    279 #define ngx_read_ahead(fd, n)    fcntl(fd, F_READAHEAD, (int) n)
    280 #define ngx_read_ahead_n         "fcntl(fd, F_READAHEAD)"
    281
    282 #elif (NGX_HAVE_POSIX_FADVISE)
    283 
    284 #define NGX_HAVE_READ_AHEAD      1
    285 
    286 ngx_int_t ngx_read_ahead(ngx_fd_t fd, size_t n);
    287 #define ngx_read_ahead_n         "posix_fadvise(POSIX_FADV_SEQUENTIAL)"
    288
    289 #else
    290
    291 #define ngx_read_ahead(fd, n)    0
    292 #define ngx_read_ahead_n         "ngx_read_ahead_n"
    293 
    294 #endif

ngx_files.c

    457 #if (NGX_HAVE_POSIX_FADVISE)
    458
    459 ngx_int_t
    460 ngx_read_ahead(ngx_fd_t fd, size_t n)
    461 {
    462     int  err;
    463
    464     err = posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
    465
    466     if (err == 0) {
    467         return 0;
    468     }
    469
    470     ngx_set_errno(err);
    471     return NGX_FILE_ERROR;
    472 }
    473
    474 #endif


===>  Building for nginx-1.0.9,1
make -f objs/Makefile
cc -c -O2 -pipe -march=native -DNO_IDEA -fno-strict-aliasing -I /usr/local/include -I src/core  -I src/event  -I src/event/modules  -I src/os/unix  -I objs  -o objs/src/os/unix/ngx_files.o  src/os/unix/ngx_files.c
src/os/unix/ngx_files.c:460: error: expected declaration specifiers or '...' before numeric constant
src/os/unix/ngx_files.c:460: error: expected declaration specifiers or '...' before '(' token
src/os/unix/ngx_files.c:461: error: conflicting types for 'fcntl'
/usr/include/fcntl.h:296: error: previous declaration of 'fcntl' was here
src/os/unix/ngx_files.c: In function 'ngx_directio_on':
src/os/unix/ngx_files.c:484: error: too many arguments to function 'fcntl'
src/os/unix/ngx_files.c:490: error: too many arguments to function 'fcntl'
src/os/unix/ngx_files.c: In function 'ngx_directio_off':
src/os/unix/ngx_files.c:499: error: too many arguments to function 'fcntl'
src/os/unix/ngx_files.c:505: error: too many arguments to function 'fcntl'
*** Error code 1

Stop in /usr/ports/www/nginx/work/nginx-1.0.9.
*** Error code 1

Stop in /usr/ports/www/nginx/work/nginx-1.0.9.
*** Error code 1

Stop in /usr/ports/www/nginx.
*** Error code 1

Stop in /usr/ports/www/nginx.

>How-To-Repeat:
compile nginx on 10-current with a current revision.
>Fix:
#if 0 #endif the offending redefine in ngx_files.c

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111101812.pAAICAZm040858>