Mercurial > hg > nginx
comparison src/os/unix/ngx_files.c @ 2248:1adec90a0e46
disable directio for unaligned reads in Linux
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 12 Sep 2008 13:50:12 +0000 |
parents | c7c319896bb4 |
children | 5e87ddb4764f |
comparison
equal
deleted
inserted
replaced
2247:981483d63e9f | 2248:1adec90a0e46 |
---|---|
387 | 387 |
388 | 388 |
389 #if (NGX_HAVE_O_DIRECT) | 389 #if (NGX_HAVE_O_DIRECT) |
390 | 390 |
391 ngx_int_t | 391 ngx_int_t |
392 ngx_directio(ngx_fd_t fd) | 392 ngx_directio_on(ngx_fd_t fd) |
393 { | 393 { |
394 int flags; | 394 int flags; |
395 | 395 |
396 flags = fcntl(fd, F_GETFL); | 396 flags = fcntl(fd, F_GETFL); |
397 | 397 |
400 } | 400 } |
401 | 401 |
402 return fcntl(fd, F_SETFL, flags | O_DIRECT); | 402 return fcntl(fd, F_SETFL, flags | O_DIRECT); |
403 } | 403 } |
404 | 404 |
405 #endif | 405 |
406 ngx_int_t | |
407 ngx_directio_off(ngx_fd_t fd) | |
408 { | |
409 int flags; | |
410 | |
411 flags = fcntl(fd, F_GETFL); | |
412 | |
413 if (flags == -1) { | |
414 return -1; | |
415 } | |
416 | |
417 return fcntl(fd, F_SETFL, flags & ~O_DIRECT); | |
418 } | |
419 | |
420 #endif |