Nginx 0.8.34 --with-file-io Linux kernel 2.6.33 patch

Hi,
I’ve tried nginx on latest Linux kernel and cant compile it. After
little fight with sources I’ve created patch for that.

Just want to ask, is it reasonable? If so, may be better to include it
in main branch for Linux build?
Please find my patch attached.

diff -Naur nginx-0.8.34.orig/auto/os/features
nginx-0.8.34.new/auto/os/features
— nginx-0.8.34.orig/auto/os/features 2009-09-30 06:21:52.000000000
-0700
+++ nginx-0.8.34.new/auto/os/features 2010-03-10 18:03:04.000000000
-0800
@@ -318,11 +318,42 @@
ngx_feature_name=“NGX_HAVE_FILE_AIO”
ngx_feature_run=no
ngx_feature_incs="#include

  •                      #include "
    
  •                      #include
    

+#ifndef SYS_eventfd
+#define SYS_eventfd 323
+#endif
+#ifndef IOCB_FLAG_RESFD
+#define IOCB_FLAG_RESFD (1 << 0)
+#endif
+struct myiocb {

  • /* these are internal to the kernel/libc. */
  • u_int64_t aio_data; /* data to be returned in event’s data */
  • u_int32_t PADDED(aio_key, aio_reserved1);
  • /* the kernel sets aio_key to the req # */
  • /* common fields */
  • u_int16_t aio_lio_opcode; /* see IOCB_CMD_ above */
  • int16_t aio_reqprio;
  • u_int32_t aio_fildes;
  • u_int64_t aio_buf;
  • u_int64_t aio_nbytes;
  • int64_t aio_offset;
  • /* extra parameters */
  • u_int64_t aio_reserved2; /* TODO: use this for a (struct sigevent *)
    */
  • u_int32_t aio_flags;
  • /*
    • If different from 0, this is an eventfd to deliver AIO results to
  • */
  • u_int32_t aio_resfd;
    +}; /* 64 bytes */
    +"
    ngx_feature_path=
    ngx_feature_libs=
    ngx_feature_test="int n = SYS_eventfd;
  •                      struct iocb  iocb;
    
  •                      struct myiocb  iocb;
                         iocb.aio_lio_opcode = IOCB_CMD_PREAD;
                         iocb.aio_flags = IOCB_FLAG_RESFD;
                         iocb.aio_resfd = -1;"
    

diff -Naur nginx-0.8.34.orig/src/os/unix/ngx_linux_aio_read.c
nginx-0.8.34.new/src/os/unix/ngx_linux_aio_read.c
— nginx-0.8.34.orig/src/os/unix/ngx_linux_aio_read.c 2009-11-05
05:12:30.000000000 -0800
+++ nginx-0.8.34.new/src/os/unix/ngx_linux_aio_read.c 2010-03-10
17:41:36.000000000 -0800
@@ -17,7 +17,7 @@

static long
-io_submit(aio_context_t ctx, long n, struct iocb **paiocb)
+io_submit(aio_context_t ctx, long n, ngx_aiocb_t **paiocb)
{
return syscall(SYS_io_submit, ctx, n, paiocb);
}
@@ -28,7 +28,7 @@
ngx_pool_t *pool)
{
long n;

  • struct iocb *piocb[1];
  • ngx_aiocb_t *piocb[1];
    ngx_event_t *ev;
    ngx_event_aio_t *aio;

diff -Naur nginx-0.8.34.orig/src/os/unix/ngx_linux_config.h
nginx-0.8.34.new/src/os/unix/ngx_linux_config.h
— nginx-0.8.34.orig/src/os/unix/ngx_linux_config.h 2009-08-28
01:12:35.000000000 -0700
+++ nginx-0.8.34.new/src/os/unix/ngx_linux_config.h 2010-03-10
18:03:50.000000000 -0800
@@ -84,7 +84,39 @@
#if (NGX_HAVE_FILE_AIO)
#include
#include
-typedef struct iocb ngx_aiocb_t;
+#ifndef SYS_eventfd
+#define SYS_eventfd 323
+#endif
+#ifndef IOCB_FLAG_RESFD
+#define IOCB_FLAG_RESFD (1 << 0)
+#endif
+
+struct myiocb {

  • /* these are internal to the kernel/libc. */
  • u_int64_t aio_data; /* data to be returned in event’s data */
  • u_int32_t PADDED(aio_key, aio_reserved1);
  • /* the kernel sets aio_key to the req # */
  • /* common fields */
  • u_int16_t aio_lio_opcode; /* see IOCB_CMD_ above */
  • int16_t aio_reqprio;
  • u_int32_t aio_fildes;
  • u_int64_t aio_buf;
  • u_int64_t aio_nbytes;
  • int64_t aio_offset;
  • /* extra parameters */
  • u_int64_t aio_reserved2; /* TODO: use this for a (struct sigevent *)
    */
  • u_int32_t aio_flags;
  • /*
    • If different from 0, this is an eventfd to deliver AIO results to
  • */
  • u_int32_t aio_resfd;
    +}; /* 64 bytes */

+typedef struct myiocb ngx_aiocb_t;
#endif

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,62545,62545#msg-62545

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs