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

**URL:** <https://www.ruby-forum.com/t/nginx-0-8-34-with-file-io-linux-kernel-2-6-33-patch/184962>\
**Category:** NGINX\
**Created:** [March 11, 2010, 3:23am UTC](https://www.ruby-forum.com/t/nginx-0-8-34-with-file-io-linux-kernel-2-6-33-patch/184962 "2010-03-11T03:23:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theromis1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/0ea827/32.png) [@theromis1](https://www.ruby-forum.com/u/theromis1)\
**Post date:** [March 11, 2010, 3:23am UTC](https://www.ruby-forum.com/t/nginx-0-8-34-with-file-io-linux-kernel-2-6-33-patch/184962/1 "2010-03-11T03:23:34Z")

</div>

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:

> **[nginx 0.8.34 --with-file-io Linux kernel 2.6.33 patch](https://forum.nginx.org/read.php?2,62545,62545#msg-62545)**
>
> 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...
