~ubuntu-branches/ubuntu/quantal/nginx/quantal-updates

« back to all changes in this revision

Viewing changes to src/os/unix/ngx_linux_aio_read.c

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry
  • Date: 2011-09-26 10:17:04 UTC
  • mfrom: (4.2.38 sid)
  • Revision ID: package-import@ubuntu.com-20110926101704-x8pxngiujrmkxnn3
Tags: 1.1.4-2
[Kartik Mistry]
* debian/modules:
  + Updated nginx-upload-progress module, Thanks to upstream for fixing issue
    that FTBFS nginx on kFreeBSD-* archs.
  + Updated nginx-lua module to latest upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
static void ngx_file_aio_event_handler(ngx_event_t *ev);
17
17
 
18
18
 
19
 
static long
 
19
static int
20
20
io_submit(aio_context_t ctx, long n, struct iocb **paiocb)
21
21
{
22
22
    return syscall(SYS_io_submit, ctx, n, paiocb);
27
27
ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset,
28
28
    ngx_pool_t *pool)
29
29
{
30
 
    long              n;
 
30
    ngx_err_t         err;
31
31
    struct iocb      *piocb[1];
32
32
    ngx_event_t      *ev;
33
33
    ngx_event_aio_t  *aio;
74
74
        }
75
75
 
76
76
        ngx_set_errno(-aio->res);
 
77
 
 
78
        ngx_log_error(NGX_LOG_CRIT, file->log, ngx_errno,
 
79
                      "aio read \"%s\" failed", file->name.data);
 
80
 
77
81
        return NGX_ERROR;
78
82
    }
79
83
 
92
96
 
93
97
    piocb[0] = &aio->aiocb;
94
98
 
95
 
    n = io_submit(ngx_aio_ctx, 1, piocb);
96
 
 
97
 
    if (n == 1) {
 
99
    if (io_submit(ngx_aio_ctx, 1, piocb) == 1) {
98
100
        ev->active = 1;
99
101
        ev->ready = 0;
100
102
        ev->complete = 0;
102
104
        return NGX_AGAIN;
103
105
    }
104
106
 
105
 
    n = -n;
 
107
    err = ngx_errno;
106
108
 
107
 
    if (n == NGX_EAGAIN) {
 
109
    if (err == NGX_EAGAIN) {
108
110
        return ngx_read_file(file, buf, size, offset);
109
111
    }
110
112
 
111
 
    ngx_log_error(NGX_LOG_CRIT, file->log, n,
 
113
    ngx_log_error(NGX_LOG_CRIT, file->log, err,
112
114
                  "io_submit(\"%V\") failed", &file->name);
113
115
 
114
 
    if (n == NGX_ENOSYS) {
 
116
    if (err == NGX_ENOSYS) {
115
117
        ngx_file_aio = 0;
116
118
        return ngx_read_file(file, buf, size, offset);
117
119
    }