Including Jeff and Brian's efforts for their respective platforms, I'm 
suggesting
the apr_socket_atmark() for backport to 0.9.  Adjusted patch is attached.

configure.in rev 1.544 1.545
include/apr.h.in rev 1.128 1.129
include/apr.hnw rev 1.37
include/apr.hw rev 1.118
include/apr_network_io.h rev 1.147
include/arch/unix/apr_arch_networkio.h rev 1.3 1.4
network_io/os2/sockopt.c rev 1.35 1.36
network_io/unix/sockopt.c rev 1.72
network_io/win32/sockopt.c rev 1.54
? apr_socket_atmark.patch
? apr_win32_poll.patch
? foo
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.535
diff -u -r1.535 configure.in
--- configure.in        2 Sep 2003 08:42:54 -0000       1.535
+++ configure.in        16 Oct 2003 17:06:55 -0000
@@ -938,6 +938,7 @@
     netinet/sctp.h      \
     netinet/sctp_uio.h  \
     sys/file.h         \
+    sys/ioctl.h         \
     sys/mman.h         \
     sys/poll.h         \
     sys/resource.h     \
@@ -946,6 +947,7 @@
     sys/sendfile.h     \
     sys/signal.h       \
     sys/socket.h       \
+    sys/sockio.h       \
     sys/stat.h          \
     sys/sysctl.h       \
     sys/syslimits.h    \
@@ -992,9 +994,11 @@
 AC_SUBST(stdlibh)
 AC_SUBST(stringh)
 AC_SUBST(stringsh)
+AC_SUBST(sys_ioctlh)
 AC_SUBST(sys_sendfileh)
 AC_SUBST(sys_signalh)
 AC_SUBST(sys_socketh)
+AC_SUBST(sys_sockioh)
 AC_SUBST(sys_typesh)
 AC_SUBST(sys_timeh)
 AC_SUBST(sys_uioh)
Index: include/apr.h.in
===================================================================
RCS file: /home/cvs/apr/include/apr.h.in,v
retrieving revision 1.124
diff -u -r1.124 apr.h.in
--- include/apr.h.in    12 May 2003 10:49:42 -0000      1.124
+++ include/apr.h.in    16 Oct 2003 17:06:57 -0000
@@ -127,9 +127,11 @@
 #define APR_HAVE_STDLIB_H        @stdlibh@
 #define APR_HAVE_STRING_H        @stringh@
 #define APR_HAVE_STRINGS_H       @stringsh@
+#define APR_HAVE_SYS_IOCTL_H     @sys_ioctlh@
 #define APR_HAVE_SYS_SENDFILE_H  @sys_sendfileh@
 #define APR_HAVE_SYS_SIGNAL_H    @sys_signalh@
 #define APR_HAVE_SYS_SOCKET_H    @sys_socketh@
+#define APR_HAVE_SYS_SOCKIO_H    @sys_sockioh@
 #define APR_HAVE_SYS_SYSLIMITS_H @sys_syslimitsh@
 #define APR_HAVE_SYS_TIME_H      @sys_timeh@
 #define APR_HAVE_SYS_TYPES_H     @sys_typesh@
Index: include/apr.hnw
===================================================================
RCS file: /home/cvs/apr/include/apr.hnw,v
retrieving revision 1.34
diff -u -r1.34 apr.hnw
--- include/apr.hnw     15 Apr 2003 21:45:58 -0000      1.34
+++ include/apr.hnw     16 Oct 2003 17:06:58 -0000
@@ -143,6 +143,7 @@
 #define APR_HAVE_SYS_SENDFILE_H 0
 #define APR_HAVE_SYS_SIGNAL_H   0
 #define APR_HAVE_SYS_SOCKET_H   0
+#define APR_HAVE_SYS_SOCKIO_H   0
 #define APR_HAVE_SYS_SYSLIMITS_H 0
 #define APR_HAVE_SYS_TIME_H     0
 #define APR_HAVE_SYS_TYPES_H    1
Index: include/apr.hw
===================================================================
RCS file: /home/cvs/apr/include/apr.hw,v
retrieving revision 1.115
diff -u -r1.115 apr.hw
--- include/apr.hw      15 Apr 2003 22:28:13 -0000      1.115
+++ include/apr.hw      16 Oct 2003 17:06:59 -0000
@@ -171,6 +171,7 @@
 #define APR_HAVE_SYS_SENDFILE_H 0
 #define APR_HAVE_SYS_SIGNAL_H   0
 #define APR_HAVE_SYS_SOCKET_H   0
+#define APR_HAVE_SYS_SOCKIO_H   0
 #define APR_HAVE_SYS_SYSLIMITS_H 0
 #define APR_HAVE_SYS_TIME_H     0
 #define APR_HAVE_SYS_TYPES_H    1
Index: include/apr_network_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_network_io.h,v
retrieving revision 1.141
diff -u -r1.141 apr_network_io.h
--- include/apr_network_io.h    30 May 2003 02:26:31 -0000      1.141
+++ include/apr_network_io.h    16 Oct 2003 17:07:01 -0000
@@ -721,6 +721,15 @@
                                                  apr_interval_time_t *t);
 
 /**
+ * Query the specified socket if at the OOB/Urgent data mark
+ * @param sock The socket to query
+ * @param atmark Is set to true if socket is at the OOB/urgent mark,
+ *               otherwise is set to false.
+ */
+APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, 
+                                            int *atmark);
+
+/**
  * Return an apr_sockaddr_t from an apr_socket_t
  * @param sa The returned apr_sockaddr_t.
  * @param which Which interface do we want the apr_sockaddr_t for?
Index: include/arch/unix/apr_arch_networkio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/apr_arch_networkio.h,v
retrieving revision 1.2
diff -u -r1.2 apr_arch_networkio.h
--- include/arch/unix/apr_arch_networkio.h      8 Jul 2003 12:53:10 -0000       
1.2
+++ include/arch/unix/apr_arch_networkio.h      16 Oct 2003 17:07:08 -0000
@@ -102,6 +102,9 @@
 #if APR_HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#if APR_HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
 #if APR_HAVE_NETDB_H
 #include <netdb.h>
 #endif
@@ -110,6 +113,9 @@
 #endif
 #if APR_HAVE_SYS_SENDFILE_H
 #include <sys/sendfile.h>
+#endif
+#if APR_HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
 #endif
 /* End System Headers */
 
Index: network_io/os2/sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/os2/sockopt.c,v
retrieving revision 1.33
diff -u -r1.33 sockopt.c
--- network_io/os2/sockopt.c    24 Feb 2003 23:13:29 -0000      1.33
+++ network_io/os2/sockopt.c    16 Oct 2003 17:07:09 -0000
@@ -170,6 +170,20 @@
 }
                                            
 
+APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark)
+{
+    int oobmark;
+
+    if (ioctl(sock->socketdes, SIOCATMARK, (void*)&oobmark, sizeof(oobmark)) < 
0) {
+        return APR_OS2_STATUS(sock_errno());
+    }
+
+    *atmark = (oobmark != 0);
+
+    return APR_SUCCESS;
+}
+
+
 APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, 
                                           apr_pool_t *cont)
 {
Index: network_io/unix/sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
retrieving revision 1.70
diff -u -r1.70 sockopt.c
--- network_io/unix/sockopt.c   30 May 2003 12:50:40 -0000      1.70
+++ network_io/unix/sockopt.c   16 Oct 2003 17:07:10 -0000
@@ -55,6 +55,7 @@
 #include "apr_arch_networkio.h"
 #include "apr_strings.h"
 
+
 static apr_status_t soblock(int sd)
 {
 /* BeOS uses setsockopt at present for non blocking... */
@@ -365,6 +366,19 @@
         default:
             *on = apr_is_option_set(sock->netmask, opt);
     }
+    return APR_SUCCESS;
+}
+
+
+apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark)
+{
+    int oobmark;
+
+    if (ioctl(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0)
+        return apr_get_netos_error();
+
+    *atmark = (oobmark != 0);
+
     return APR_SUCCESS;
 }
 
Index: network_io/win32/sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/win32/sockopt.c,v
retrieving revision 1.52
diff -u -r1.52 sockopt.c
--- network_io/win32/sockopt.c  24 Feb 2003 23:13:30 -0000      1.52
+++ network_io/win32/sockopt.c  16 Oct 2003 17:07:18 -0000
@@ -276,6 +276,19 @@
 }
                                            
 
+APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark)
+{
+    u_long oobmark;
+
+    if (ioctlsocket(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0)
+        return apr_get_netos_error();
+
+    *atmark = (oobmark != 0);
+
+    return APR_SUCCESS;
+}
+
+
 APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len,
                                           apr_pool_t *cont)
 {


Reply via email to