You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/28 16:13:22 UTC
svn commit: r819543 - in /commons/sandbox/runtime/trunk/src/main/native:
include/ include/arch/darwin/ include/arch/hpux/ include/arch/linux/
include/arch/solaris/ os/unix/ os/win32/
Author: mturk
Date: Mon Sep 28 14:13:21 2009
New Revision: 819543
URL: http://svn.apache.org/viewvc?rev=819543&view=rev
Log:
Use NONBLOCK instead BUFFERED
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h
commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h
commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h
commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h
commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h
commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr_file.h Mon Sep 28 14:13:21 2009
@@ -89,7 +89,7 @@
#define ACR_FOPEN_BINARY 0x00020 /**< Open the file in binary mode */
#define ACR_FOPEN_EXCL 0x00040 /**< Open should fail if APR_CREATE
and file exists. */
-#define ACR_FOPEN_BUFFERED 0x00080 /**< Open the file for buffered I/O */
+#define ACR_FOPEN_NONBLOCK 0x00080 /**< Open the file for non blocking I/O */
#define ACR_FOPEN_DELONCLOSE 0x00100 /**< Delete the file after close */
#define ACR_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for
@@ -164,6 +164,8 @@
Must be first stuct element so we
can pass this structure directly
to the completion routines. */
+#else
+ struct pollfd ppoll; /**< polldf structure */
#endif
acr_pchar_t *name; /**< Real file name */
acr_osd_t fd; /**< Os file descriptor */
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/darwin/acr_arch_private.h Mon Sep 28 14:13:21 2009
@@ -26,6 +26,7 @@
#include <mach-o/arch.h>
#include <signal.h>
#include <fnmatch.h>
+#include <poll.h>
#ifdef __cplusplus
extern "C" {
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/hpux/acr_arch_private.h Mon Sep 28 14:13:21 2009
@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <sys/utsname.h>
#include <signal.h>
+#include <poll.h>
#ifdef __cplusplus
extern "C" {
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/linux/acr_arch_private.h Mon Sep 28 14:13:21 2009
@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <sys/utsname.h>
#include <fnmatch.h>
+#include <poll.h>
#ifdef __cplusplus
extern "C" {
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/solaris/acr_arch_private.h Mon Sep 28 14:13:21 2009
@@ -21,6 +21,7 @@
*/
#include <sys/stat.h>
#include <sys/systeminfo.h>
+#include <poll.h>
#ifdef __cplusplus
extern "C" {
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c Mon Sep 28 14:13:21 2009
@@ -145,6 +145,22 @@
goto finally;
}
}
+#ifdef O_NONBLOCK
+ if (flags & ACR_FOPEN_NONBLOCK) {
+ /* Use non-blocking I/O
+ */
+ int mode;
+ if ((mode = fcntl(fd, F_GETFL, 0)) == -1) {
+ rc = ACR_GET_OS_ERROR();
+ goto finally;
+ }
+ mode |= O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, mode) == -1) {
+ rc = ACR_GET_OS_ERROR();
+ goto finally;
+ }
+ }
+#endif
fp = ACR_CALLOC(acr_file_t, 1);
if (!fp) {
rc = ACR_ENOMEM;
@@ -154,10 +170,10 @@
fp->name = ACR_StrdupA(_E, THROW_NMARK, fname);
fp->flags = flags;
fp->type = ACR_FT_REG; /* Presume it's a regular file */
- if (!(flags & ACR_FOPEN_NOCLEANUP))
- fo = acr_ioh_open(fp, ACR_DT_FILE, 0, file_cleanup);
- else
+ if (flags & ACR_FOPEN_NOCLEANUP)
fo = acr_ioh_open(fp, ACR_DT_FILE, 0, NULL);
+ else
+ fo = acr_ioh_open(fp, ACR_DT_FILE, 0, file_cleanup);
if (fo < 0) {
rc = ACR_GET_OS_ERROR();
goto finally;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=819543&r1=819542&r2=819543&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Mon Sep 28 14:13:21 2009
@@ -119,6 +119,8 @@
}
if (flags & ACR_FOPEN_DELONCLOSE)
aflags |= FILE_FLAG_DELETE_ON_CLOSE;
+ if (flags & ACR_FOPEN_NONBLOCK)
+ aflags |= FILE_FLAG_OVERLAPPED;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = FALSE;
if (prot == ACR_FPROT_OS_DEFAULT) {