diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-11-20 07:14:38 +0000 |
commit | 4f9b76b6f2acc4030ce9ef164322514c5d0e761b (patch) | |
tree | 9b993b3753affcbf164056826f9d568d8760b3a1 /network_io | |
parent | 961caf5f46055483fa72ab02f5e8baa16c209e2f (diff) | |
download | apr-4f9b76b6f2acc4030ce9ef164322514c5d0e761b.tar.gz |
Remove trailing whitespaces in *.c.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/beos/sendrecv.c | 20 | ||||
-rw-r--r-- | network_io/os2/sendrecv.c | 6 | ||||
-rw-r--r-- | network_io/os2/sendrecv_udp.c | 2 | ||||
-rw-r--r-- | network_io/os2/sockets.c | 34 | ||||
-rw-r--r-- | network_io/os2/sockopt.c | 12 | ||||
-rw-r--r-- | network_io/unix/multicast.c | 12 | ||||
-rw-r--r-- | network_io/unix/sendrecv.c | 72 | ||||
-rw-r--r-- | network_io/unix/sockaddr.c | 68 | ||||
-rw-r--r-- | network_io/unix/sockets.c | 36 | ||||
-rw-r--r-- | network_io/unix/sockopt.c | 24 | ||||
-rw-r--r-- | network_io/win32/sendrecv.c | 48 | ||||
-rw-r--r-- | network_io/win32/sockets.c | 54 | ||||
-rw-r--r-- | network_io/win32/sockopt.c | 30 |
13 files changed, 209 insertions, 209 deletions
diff --git a/network_io/beos/sendrecv.c b/network_io/beos/sendrecv.c index 201abf89c..e28512133 100644 --- a/network_io/beos/sendrecv.c +++ b/network_io/beos/sendrecv.c @@ -40,7 +40,7 @@ static apr_status_t wait_for_io_or_timeout(apr_socket_t *sock, int for_read) } srv = select(sock->socketdes + 1, for_read ? &fdset : NULL, - for_read ? NULL : &fdset, + for_read ? NULL : &fdset, NULL, tvptr); /* TODO - timeout should be smaller on repeats of this loop */ @@ -61,15 +61,15 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len) { apr_ssize_t rv; - + do { rv = send(sock->socketdes, buf, (*len), 0); } while (rv == -1 && errno == EINTR); if (rv == -1 && errno == EWOULDBLOCK && sock->timeout > 0) { apr_int32_t snooze_val = SEND_WAIT; - apr_int32_t zzz = 0; - + apr_int32_t zzz = 0; + do { rv = send(sock->socketdes, buf, (*len), 0); if (rv == -1 && errno == EWOULDBLOCK){ @@ -91,11 +91,11 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, +APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) { apr_ssize_t rv; - + do { rv = recv(sock->socketdes, buf, (*len), 0); } while (rv == -1 && errno == EINTR); @@ -124,7 +124,7 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, /* BeOS doesn't have writev for sockets so we use the following instead... */ -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, apr_int32_t nvec, apr_size_t *len) { @@ -132,7 +132,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, return apr_socket_send(sock, vec[0].iov_base, len); } -APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, apr_int32_t flags, const char *buf, apr_size_t *len) @@ -203,9 +203,9 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, (*len) = 0; return errno; } - + from->port = ntohs(from->sa.sin.sin_port); - + (*len) = rv; if (rv == 0) return APR_EOF; diff --git a/network_io/os2/sendrecv.c b/network_io/os2/sendrecv.c index 4f67b3b31..fa2f63779 100644 --- a/network_io/os2/sendrecv.c +++ b/network_io/os2/sendrecv.c @@ -105,8 +105,8 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, - const struct iovec *vec, +APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, + const struct iovec *vec, apr_int32_t nvec, apr_size_t *len) { apr_status_t rv; @@ -159,7 +159,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, APR_DECLARE(apr_status_t) apr_socket_wait(apr_socket_t *sock, apr_wait_type_t direction) { int pollsocket = sock->socketdes; - int wait_rc = select(&pollsocket, direction == APR_WAIT_READ, + int wait_rc = select(&pollsocket, direction == APR_WAIT_READ, direction == APR_WAIT_WRITE, 0, sock->timeout / 1000); if (wait_rc == 0) { diff --git a/network_io/os2/sendrecv_udp.c b/network_io/os2/sendrecv_udp.c index 1aea02c25..7bd414fea 100644 --- a/network_io/os2/sendrecv_udp.c +++ b/network_io/os2/sendrecv_udp.c @@ -48,7 +48,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, int serrno; do { - rv = sendto(sock->socketdes, buf, (*len), flags, + rv = sendto(sock->socketdes, buf, (*len), flags, (struct sockaddr*)&where->sa, where->salen); diff --git a/network_io/os2/sockets.c b/network_io/os2/sockets.c index 89d987603..60223d177 100644 --- a/network_io/os2/sockets.c +++ b/network_io/os2/sockets.c @@ -115,13 +115,13 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int (*new)->timeout = -1; (*new)->nonblock = FALSE; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; -} +} -APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, +APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) { if (shutdown(thesocket->socketdes, how) == 0) { @@ -141,7 +141,7 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { - if (bind(sock->socketdes, + if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) return APR_FROM_OS_ERROR(sock_errno()); @@ -155,7 +155,7 @@ APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, } } -APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) @@ -164,7 +164,7 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *connection_context) { @@ -174,7 +174,7 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->timeout = -1; (*new)->nonblock = FALSE; - (*new)->socketdes = accept(sock->socketdes, + (*new)->socketdes = accept(sock->socketdes, (struct sockaddr *)&(*new)->remote_addr->sa, &(*new)->remote_addr->salen); @@ -191,7 +191,7 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr; } - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -199,14 +199,14 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { - if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, + if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, sa->salen) < 0) && (sock_errno() != SOCEINPROGRESS)) { return APR_FROM_OS_ERROR(sock_errno()); } else { int namelen = sizeof(sock->local_addr->sa.sin); - getsockname(sock->socketdes, (struct sockaddr *)&sock->local_addr->sa.sin, + getsockname(sock->socketdes, (struct sockaddr *)&sock->local_addr->sa.sin, &namelen); sock->remote_addr = sa; return APR_SUCCESS; @@ -262,8 +262,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t * return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, +APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, + apr_os_sock_info_t *os_sock_info, apr_pool_t *cont) { alloc_socket(apr_sock, cont); @@ -271,8 +271,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->timeout = -1; (*apr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, - os_sock_info->local, + memcpy(&(*apr_sock)->local_addr->sa.sin, + os_sock_info->local, (*apr_sock)->local_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); @@ -281,7 +281,7 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*apr_sock)->remote_addr->sa.sin, os_sock_info->remote, (*apr_sock)->remote_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ @@ -290,8 +290,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, else { (*apr_sock)->remote_addr_unknown = 1; } - - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + + apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; diff --git a/network_io/os2/sockopt.c b/network_io/os2/sockopt.c index 0cce8d78e..80da886b4 100644 --- a/network_io/os2/sockopt.c +++ b/network_io/os2/sockopt.c @@ -29,7 +29,7 @@ #include <sys/so_ioctl.h> -APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) { apr_status_t rv = APR_SUCCESS; @@ -44,14 +44,14 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, } else if (t != 0 && sock->timeout == 0) { rv = apr_socket_opt_set(sock, APR_SO_NONBLOCK, 0); - } + } sock->timeout = t; return rv; } -APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on) { int one; @@ -110,7 +110,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) { *t = sock->timeout; @@ -118,7 +118,7 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on) { switch(opt) { @@ -143,7 +143,7 @@ APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) } -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, +APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) { if (gethostname(buf, len) == -1) { diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c index a8c85ce69..98d949818 100644 --- a/network_io/unix/multicast.c +++ b/network_io/unix/multicast.c @@ -47,15 +47,15 @@ static void fill_mip_v4(struct ip_mreq *mip, apr_sockaddr_t *mcast, static unsigned int find_if_index(const apr_sockaddr_t *iface) { unsigned int index = 0; -#if defined(HAVE_GETIFADDRS) && APR_HAVE_IFADDRS_H && APR_HAVE_IPV6 +#if defined(HAVE_GETIFADDRS) && APR_HAVE_IFADDRS_H && APR_HAVE_IPV6 struct ifaddrs *ifp, *ifs; /** - * TODO: getifaddrs is only portable to *BSD and OS X. Using ioctl + * TODO: getifaddrs is only portable to *BSD and OS X. Using ioctl * and SIOCGIFCONF is needed for Linux/Solaris support. - * - * There is a wrapper that takes the messy ioctl interface into - * getifaddrs. The license is acceptable, but, It is a fairly large + * + * There is a wrapper that takes the messy ioctl interface into + * getifaddrs. The license is acceptable, but, It is a fairly large * chunk of code. */ if (getifaddrs(&ifs) != 0) { @@ -129,7 +129,7 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock, #ifdef GROUP_FILTER_SIZE if (sock_is_ipv4(sock)) { ip_proto = IPPROTO_IP; - } + } #if APR_HAVE_IPV6 else if (sock_is_ipv6(sock)) { ip_proto = IPPROTO_IPV6; diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 6721a66e9..34e4b8e45 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -27,11 +27,11 @@ #include <osreldate.h> #endif -apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, +apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len) { apr_ssize_t rv; - + if (sock->options & APR_INCOMPLETE_WRITE) { sock->options &= ~APR_INCOMPLETE_WRITE; goto do_select; @@ -41,7 +41,7 @@ apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, rv = write(sock->socketdes, buf, (*len)); } while (rv == -1 && errno == EINTR); - while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) + while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv; do_select: @@ -116,8 +116,8 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, apr_ssize_t rv; do { - rv = sendto(sock->socketdes, buf, (*len), flags, - (const struct sockaddr*)&where->sa, + rv = sendto(sock->socketdes, buf, (*len), flags, + (const struct sockaddr*)&where->sa, where->salen); } while (rv == -1 && errno == EINTR); @@ -144,15 +144,15 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, } apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, + apr_int32_t flags, char *buf, apr_size_t *len) { apr_ssize_t rv; - + from->salen = sizeof(from->sa); do { - rv = recvfrom(sock->socketdes, buf, (*len), flags, + rv = recvfrom(sock->socketdes, buf, (*len), flags, (struct sockaddr*)&from->sa, &from->salen); } while (rv == -1 && errno == EINTR); @@ -207,7 +207,7 @@ apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, rv = writev(sock->socketdes, vec, nvec); } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv; do_select: @@ -279,12 +279,12 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, /* 64-bit apr_off_t but no sendfile64(): fail if trying to send * past the 2Gb limit. */ off_t off; - + if ((apr_int64_t)*offset + bytes_to_send > INT_MAX) { *len = 0; return EINVAL; } - + off = *offset; #else @@ -325,8 +325,8 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return arv; } - /* If this was a partial write and we aren't doing timeouts, - * return now with the partial byte count; this is a non-blocking + /* If this was a partial write and we aren't doing timeouts, + * return now with the partial byte count; this is a non-blocking * socket. */ total_hdrbytes = 0; @@ -353,7 +353,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, bytes_to_send); /* number of bytes to send */ } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -388,8 +388,8 @@ do_select: arv = APR_SUCCESS; } if (rv > 0) { - - /* If this was a partial write, return now with the + + /* If this was a partial write, return now with the * partial byte count; this is a non-blocking socket. */ @@ -400,7 +400,7 @@ do_select: } else { /* If the file got smaller mid-request, eventually the offset - * becomes equal to the new file size and the kernel returns 0. + * becomes equal to the new file size and the kernel returns 0. * Make this an error so the caller knows to log something and * exit. */ @@ -446,8 +446,8 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, hdtr = &no_hdtr; } - /* OS X can send the headers/footers as part of the system call, - * but how it counts bytes isn't documented properly. We use + /* OS X can send the headers/footers as part of the system call, + * but how it counts bytes isn't documented properly. We use * apr_socket_sendv() instead. */ if (hdtr->numheaders > 0) { @@ -566,9 +566,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, #if defined(__FreeBSD_version) && __FreeBSD_version < 460001 else if (hdtr->numheaders) { - /* On early versions of FreeBSD sendfile, the number of bytes to send - * must include the length of the headers. Don't look at the man page - * for this :( Instead, look at the logic in + /* On early versions of FreeBSD sendfile, the number of bytes to send + * must include the length of the headers. Don't look at the man page + * for this :( Instead, look at the logic in * src/sys/kern/uipc_syscalls::sendfile(). * * This was fixed in the middle of 4.6-STABLE @@ -635,7 +635,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, } *len += nbytes; } - } + } else { /* just trailer bytes... use writev() */ @@ -673,7 +673,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, /* ssize_t sendfile(int s, int fd, off_t offset, size_t nbytes, * const struct iovec *hdtrl, int flags); * - * nbytes is the number of bytes to send just from the file; as with FreeBSD, + * nbytes is the number of bytes to send just from the file; as with FreeBSD, * if nbytes == 0, the rest of the file (from offset) is sent */ @@ -728,7 +728,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, headerlen = 0; for (i = 0; i < hdtr->numheaders; i++) { headerlen += hdtr->headers[i].iov_len; - } + } /* XXX: BUHHH? wow, what a memory leak! */ headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->pool, headerlen); @@ -780,7 +780,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } } while (rc == -1 && errno == EINTR); - while ((rc == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rc == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -927,7 +927,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, flags); /* flags */ } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -957,7 +957,7 @@ do_select: } if ((sock->timeout > 0) - && (parms.bytes_sent + && (parms.bytes_sent < (parms.file_bytes + parms.header_length + parms.trailer_length))) { sock->options |= APR_INCOMPLETE_WRITE; } @@ -970,7 +970,7 @@ do_select: * hang the machine and the only way to fix it is a reboot. */ #elif defined(HAVE_SENDFILEV) -/* Solaris 8's sendfilev() interface +/* Solaris 8's sendfilev() interface * * SFV_FD_SELF refers to our memory space. * @@ -1027,7 +1027,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, sfv[curvec].sfv_fd = file->filedes; sfv[curvec].sfv_flag = 0; sfv[curvec].sfv_off = *offset; - sfv[curvec].sfv_len = *len; + sfv[curvec].sfv_len = *len; requested_len += sfv[curvec].sfv_len; curvec++; @@ -1056,14 +1056,14 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return arv; } } - + /* Actually do the sendfilev * * Solaris may return -1/EAGAIN even if it sent bytes on a non-block sock. * - * If no bytes were originally sent (nbytes == 0) and we are on a TIMEOUT - * socket (which as far as the OS is concerned is a non-blocking socket), - * we want to retry after waiting for the other side to read the data (as + * If no bytes were originally sent (nbytes == 0) and we are on a TIMEOUT + * socket (which as far as the OS is concerned is a non-blocking socket), + * we want to retry after waiting for the other side to read the data (as * determined by poll). Once it is clear to send, we want to retry * sending the sendfilevec_t once more. */ @@ -1087,7 +1087,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return t; } - arv = 1; + arv = 1; repeat = 1; } } @@ -1115,7 +1115,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } #else #error APR has detected sendfile on your system, but nobody has written a -#error version of it for APR yet. To get past this, either write +#error version of it for APR yet. To get past this, either write #error apr_socket_sendfile or change APR_HAS_SENDFILE in apr.h to 0. #endif /* __linux__, __FreeBSD__, __DragonFly__, __HPUX__, _AIX, __MVS__, Tru64/OSF1 */ diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c index 16712fec2..d3bce601c 100644 --- a/network_io/unix/sockaddr.c +++ b/network_io/unix/sockaddr.c @@ -122,7 +122,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen, } #if APR_HAVE_IPV6 - if (sockaddr->family == AF_INET6 + if (sockaddr->family == AF_INET6 && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)sockaddr->ipaddr_ptr) && buflen > strlen("::ffff:")) { /* This is an IPv4-mapped IPv6 address; drop the leading @@ -153,7 +153,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen, *p++ = '%'; memcpy(p, scbuf, strlen(scbuf) + 1); } - } + } #endif /* HAVE_IF_INDEXTONAME */ #endif /* APR_HAVE_IPV6 */ @@ -283,9 +283,9 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, /* now handle the hostname */ addrlen = lastchar - str + 1; -/* XXX we don't really have to require APR_HAVE_IPV6 for this; +/* XXX we don't really have to require APR_HAVE_IPV6 for this; * just pass char[] for ipaddr (so we don't depend on struct in6_addr) - * and always define APR_INET6 + * and always define APR_INET6 */ #if APR_HAVE_IPV6 if (*str == '[') { @@ -320,10 +320,10 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, return APR_EINVAL; } } - else + else #endif { - /* XXX If '%' is not a valid char in a DNS name, we *could* check + /* XXX If '%' is not a valid char in a DNS name, we *could* check * for bogus scope ids first. */ *addr = apr_pstrmemdup(p, str, addrlen); @@ -335,13 +335,13 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, static apr_status_t call_resolver(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { struct addrinfo hints, *ai, *ai_list; apr_sockaddr_t *prev_sa; int error; - char *servname = NULL; + char *servname = NULL; memset(&hints, 0, sizeof(hints)); hints.ai_family = family; @@ -356,16 +356,16 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, #endif #ifdef __MVS__ - /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results - * are returned, w/o AI_ALL. + /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results + * are returned, w/o AI_ALL. */ - if (family == APR_UNSPEC) { + if (family == APR_UNSPEC) { hints.ai_flags |= AI_ALL; } #endif if(hostname == NULL) { -#ifdef AI_PASSIVE +#ifdef AI_PASSIVE /* If hostname is NULL, assume we are trying to bind to all * interfaces. */ hints.ai_flags |= AI_PASSIVE; @@ -426,11 +426,11 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, if (error == EAI_SYSTEM) { return errno ? errno : APR_EGENERAL; } - else + else { /* issues with representing this with APR's error scheme: - * glibc uses negative values for these numbers, perhaps so - * they don't conflict with h_errno values... Tru64 uses + * glibc uses negative values for these numbers, perhaps so + * they don't conflict with h_errno values... Tru64 uses * positive values which conflict with h_errno values */ #if defined(NEGATIVE_EAI) @@ -491,9 +491,9 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, return APR_SUCCESS; } -static apr_status_t find_addresses(apr_sockaddr_t **sa, +static apr_status_t find_addresses(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { if (flags & APR_IPV4_ADDR_OK) { @@ -525,9 +525,9 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #else /* end of HAVE_GETADDRINFO code */ -static apr_status_t find_addresses(apr_sockaddr_t **sa, +static apr_status_t find_addresses(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { struct hostent *hp; @@ -573,7 +573,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #else #if defined(GETHOSTBYNAME_R_GLIBC2) /* Linux glibc2+ */ - gethostbyname_r(hostname, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, + gethostbyname_r(hostname, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, &hp, &hosterror); #else /* Solaris, Irix et alia */ @@ -632,7 +632,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #endif /* end of !HAVE_GETADDRINFO code */ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, - const char *hostname, + const char *hostname, apr_int32_t family, apr_port_t port, apr_int32_t flags, apr_pool_t *p) { @@ -791,7 +791,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, return errno + APR_OS_START_SYSERR; } } - else + else #endif { #if defined(NEGATIVE_EAI) @@ -800,7 +800,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, return rc + APR_OS_START_EAIERR; /* return the EAI_ error */ } } - *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, + *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, tmphostname); return APR_SUCCESS; #else @@ -816,18 +816,18 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #if defined(GETHOSTBYNAME_R_HOSTENT_DATA) /* AIX, HP/UX, D/UX et alia */ - gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, &hd); hptr = &hs; #else #if defined(GETHOSTBYNAME_R_GLIBC2) /* Linux glibc2+ */ - gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, &hptr, &hosterror); #else /* Solaris, Irix et alia */ - hptr = gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + hptr = gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, tmp, GETHOSTBYNAME_BUFLEN, &hosterror); #endif /* !defined(GETHOSTBYNAME_R_GLIBC2) */ @@ -838,7 +838,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #endif /* !defined(GETHOSTBYNAME_R_HOSTENT_DATA) */ #else struct hostent *hptr; - hptr = gethostbyaddr((char *)&sockaddr->sa.sin.sin_addr, + hptr = gethostbyaddr((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET); #endif @@ -1046,7 +1046,7 @@ static apr_status_t parse_ip(apr_ipsubnet_t *ipsub, const char *ipstr, int netwo /* supported flavors of IP: * * . IPv6 numeric address string (e.g., "fe80::1") - * + * * IMPORTANT: Don't store IPv4-mapped IPv6 address as an IPv6 address. * * . IPv4 numeric address string (e.g., "127.0.0.1") @@ -1093,7 +1093,7 @@ static int looks_like_ip(const char *ipstr) if (strlen(ipstr) == 0) { return 0; } - + if (strchr(ipstr, ':')) { /* definitely not a hostname; assume it is intended to be an IPv6 address */ return 1; @@ -1118,14 +1118,14 @@ static void fix_subnet(apr_ipsubnet_t *ipsub) } /* be sure not to store any IPv4 address as a v4-mapped IPv6 address */ -APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, +APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, const char *mask_or_numbits, apr_pool_t *p) { apr_status_t rv; char *endptr; long bits, maxbits = 32; - /* filter out stuff which doesn't look remotely like an IP address; this helps + /* filter out stuff which doesn't look remotely like an IP address; this helps * callers like mod_access which have a syntax allowing hostname or IP address; * APR_EINVAL tells the caller that it was probably not intended to be an IP * address @@ -1227,7 +1227,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_set(apr_sockaddr_t *sa, return APR_ENOTIMPL; #else unsigned int idx; - + if (sa->family != APR_INET6 || !IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)sa->ipaddr_ptr)) { return APR_EBADIP; @@ -1266,7 +1266,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa, #else if (sa->family != APR_INET6 || !sa->sa.sin6.sin6_scope_id) { return APR_EBADIP; - } + } if (name) { char *buf = apr_palloc(p, IF_NAMESIZE); @@ -1276,7 +1276,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa, } if (id) *id = sa->sa.sin6.sin6_scope_id; - + return APR_SUCCESS; #endif } diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index e95ce2c7d..be992d4f7 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -50,7 +50,7 @@ static apr_status_t socket_cleanup(void *sock) /* XXX: Check for return values ? */ unlink(thesocket->local_addr->hostname); } -#endif +#endif if (close(sd) == 0) { return APR_SUCCESS; } @@ -200,9 +200,9 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, socket_child_cleanup); return APR_SUCCESS; -} +} -apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, +apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) { return (shutdown(thesocket->socketdes, how) == -1) ? errno : APR_SUCCESS; @@ -215,7 +215,7 @@ apr_status_t apr_socket_close(apr_socket_t *thesocket) apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { - if (bind(sock->socketdes, + if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { return errno; } @@ -275,7 +275,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, return errno; } #ifdef TPF - if (s == 0) { + if (s == 0) { /* 0 is an invalid socket for TPF */ return APR_EINTR; } @@ -304,8 +304,8 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, *(*new)->local_addr = *sock->local_addr; - /* The above assignment just overwrote the pool entry. Setting the local_addr - pool for the accepted socket back to what it should be. Otherwise all + /* The above assignment just overwrote the pool entry. Setting the local_addr + pool for the accepted socket back to what it should be. Otherwise all allocations for this socket will come from a server pool that is not freed until the process goes down.*/ (*new)->local_addr->pool = connection_context; @@ -348,7 +348,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, !memcmp(sock->local_addr->ipaddr_ptr, generic_inaddr_any, sock->local_addr->ipaddr_len)) { - /* If the interface address inside the listening socket's local_addr wasn't + /* If the interface address inside the listening socket's local_addr wasn't * up-to-date, we don't know local interface of the connected socket either. * * If the listening socket was not bound to a specific interface, we @@ -387,7 +387,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { - int rc; + int rc; do { rc = connect(sock->socketdes, @@ -409,7 +409,7 @@ apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { int error; apr_socklen_t len = sizeof(error); - if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, + if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, (char *)&error, &len)) < 0) { return errno; } @@ -509,8 +509,8 @@ apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock) return APR_SUCCESS; } -apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, +apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, + apr_os_sock_info_t *os_sock_info, apr_pool_t *cont) { alloc_socket(apr_sock, cont); @@ -518,8 +518,8 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->timeout = -1; (*apr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, - os_sock_info->local, + memcpy(&(*apr_sock)->local_addr->sa.sin, + os_sock_info->local, (*apr_sock)->local_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); @@ -531,7 +531,7 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, #ifndef HAVE_POLL (*apr_sock)->connected = 1; #endif - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*apr_sock)->remote_addr->sa.sin, os_sock_info->remote, (*apr_sock)->remote_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ @@ -540,14 +540,14 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, else { (*apr_sock)->remote_addr_unknown = 1; } - + (*apr_sock)->inherit = 0; - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), socket_cleanup, socket_cleanup); return APR_SUCCESS; } -apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, +apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, apr_pool_t *cont) { /* XXX Bogus assumption that *sock points at anything legit */ diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index c48ab06a5..8579f5d7d 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -90,14 +90,14 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) } apr_set_option(sock, APR_SO_NONBLOCK, 1); } - } + } else if (t < 0 && sock->timeout >= 0) { - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { - if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { - return stat; + if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { + if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { + return stat; } apr_set_option(sock, APR_SO_NONBLOCK, 0); - } + } } /* must disable the incomplete read support if we disable * a timeout @@ -110,7 +110,7 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) } -apr_status_t apr_socket_opt_set(apr_socket_t *sock, +apr_status_t apr_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on) { int one; @@ -182,7 +182,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, case APR_SO_NONBLOCK: if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { - if ((rv = sononblock(sock->socketdes)) != APR_SUCCESS) + if ((rv = sononblock(sock->socketdes)) != APR_SUCCESS) return rv; } else { @@ -213,7 +213,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; - if (setsockopt(sock->socketdes, optlevel, optname, + if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { return errno; } @@ -348,8 +348,8 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, return APR_EINVAL; } - return APR_SUCCESS; -} + return APR_SUCCESS; +} apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) @@ -359,7 +359,7 @@ apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) } -apr_status_t apr_socket_opt_get(apr_socket_t *sock, +apr_status_t apr_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on) { switch(opt) { @@ -392,7 +392,7 @@ apr_status_t apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) if (gethostname(buf, len) == 0) { #else if (gethostname(buf, len) != 0) { -#endif +#endif buf[0] = '\0'; return errno; } diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index b3e2a1c90..d98201746 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -25,10 +25,10 @@ #endif /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client - * in one call of TransmitFile. This number must be small enough to give the + * in one call of TransmitFile. This number must be small enough to give the * slowest client time to receive the data before the socket timeout triggers. * The same problem can exist with apr_socket_send(). In that case, we rely on - * the application to adjust socket timeouts and max send segment + * the application to adjust socket timeouts and max send segment * sizes appropriately. * For example, Apache will in most cases call apr_socket_send() with less * than 8193 bytes. @@ -61,7 +61,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) + apr_size_t *len) { apr_ssize_t rv; WSABUF wsaData; @@ -129,13 +129,13 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, + apr_int32_t flags, const char *buf, apr_size_t *len) { apr_ssize_t rv; - rv = sendto(sock->socketdes, buf, (int)*len, flags, - (const struct sockaddr*)&where->sa, + rv = sendto(sock->socketdes, buf, (int)*len, flags, + (const struct sockaddr*)&where->sa, where->salen); if (rv == SOCKET_ERROR) { *len = 0; @@ -147,23 +147,23 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, +APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, + apr_int32_t flags, char *buf, apr_size_t *len) { apr_ssize_t rv; from->salen = sizeof(from->sa); - rv = recvfrom(sock->socketdes, buf, (int)*len, flags, + rv = recvfrom(sock->socketdes, buf, (int)*len, flags, (struct sockaddr*)&from->sa, &from->salen); if (rv == SOCKET_ERROR) { (*len) = 0; return apr_get_netos_error(); } - apr_sockaddr_vars_set(from, from->sa.sin.sin_family, + apr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port)); (*len) = rv; @@ -175,8 +175,8 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, #if APR_HAS_SENDFILE -static apr_status_t collapse_iovec(char **off, apr_size_t *len, - struct iovec *iovec, int numvec, +static apr_status_t collapse_iovec(char **off, apr_size_t *len, + struct iovec *iovec, int numvec, char *buf, apr_size_t buflen) { if (numvec == 1) { @@ -206,9 +206,9 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, /* - * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, + * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, * apr_off_t *, apr_size_t *, apr_int32_t flags) - * Send a file from an open file descriptor to a socket, along with + * Send a file from an open file descriptor to a socket, along with * optional headers and trailers * arg 1) The socket to which we're writing * arg 2) The open file from which to read @@ -217,12 +217,12 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, * arg 5) Number of bytes to send out of the file * arg 6) APR flags that are mapped to OS specific flags */ -APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, apr_hdtr_t *hdtr, apr_off_t *offset, apr_size_t *len, - apr_int32_t flags) + apr_int32_t flags) { apr_status_t status = APR_SUCCESS; apr_status_t rv; @@ -263,7 +263,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, * Long TransmitFile requests are defined as requests that require more * than a single read from the file or a cache; the request therefore * depends on the size of the file and the specified length of the send - * packet. + * packet. * * Use of TF_USE_KERNEL_APC can deliver significant performance benefits. * It is possible (though unlikely), however, that the thread in which @@ -281,7 +281,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { - rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); if (rv != APR_SUCCESS) return rv; @@ -304,8 +304,8 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, apr_size_t head_length = tfb.HeadLength; ptfb = &tfb; nbytes = 0; - rv = collapse_iovec((char **)&ptfb->Head, &head_length, - hdtr->headers, hdtr->numheaders, + rv = collapse_iovec((char **)&ptfb->Head, &head_length, + hdtr->headers, hdtr->numheaders, hdtrbuf, sizeof(hdtrbuf)); tfb.HeadLength = (DWORD)head_length; @@ -356,7 +356,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, sock->overlapped->Offset = (DWORD)(curoff); #if APR_HAS_LARGE_FILES sock->overlapped->OffsetHigh = (DWORD)(curoff >> 32); -#endif +#endif /* XXX BoundsChecker claims dwFlags must not be zero. */ rv = pfn_transmit_file(sock->socketdes, /* socket */ file->filehand, /* open file descriptor of the file to be sent */ @@ -368,10 +368,10 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, if (!rv) { status = apr_get_netos_error(); if ((status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) || - (status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) + (status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) { - rv = WaitForSingleObject(sock->overlapped->hEvent, - (DWORD)(sock->timeout >= 0 + rv = WaitForSingleObject(sock->overlapped->hEvent, + (DWORD)(sock->timeout >= 0 ? sock->timeout_ms : INFINITE)); if (rv == WAIT_OBJECT_0) { status = APR_SUCCESS; diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c index 8d7404df7..f94533c23 100644 --- a/network_io/win32/sockets.c +++ b/network_io/win32/sockets.c @@ -64,7 +64,7 @@ static void set_socket_vars(apr_socket_t *sock, int family, int type, int protoc apr_set_option(sock, APR_IPV6_V6ONLY, 1); } #endif -} +} static void alloc_socket(apr_socket_t **new, apr_pool_t *p) { *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t)); @@ -72,7 +72,7 @@ static void alloc_socket(apr_socket_t **new, apr_pool_t *p) (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, sizeof(apr_sockaddr_t)); (*new)->local_addr->pool = p; - + (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, sizeof(apr_sockaddr_t)); (*new)->remote_addr->pool = p; @@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock, } APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, - int type, int protocol, + int type, int protocol, apr_pool_t *cont) { DWORD flags; @@ -153,11 +153,11 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, (*new)->timeout = -1; (*new)->disconnected = 0; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; -} +} APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) @@ -199,8 +199,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { - if (bind(sock->socketdes, - (struct sockaddr *)&sa->sa, + if (bind(sock->socketdes, + (struct sockaddr *)&sa->sa, sa->salen) == -1) { return apr_get_netos_error(); } @@ -236,7 +236,7 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, +APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_pool_t *p) { SOCKET s; @@ -255,10 +255,10 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, } alloc_socket(new, p); - set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, + set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); - (*new)->timeout = -1; + (*new)->timeout = -1; (*new)->disconnected = 0; (*new)->socketdes = s; @@ -269,8 +269,8 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, *(*new)->local_addr = *sock->local_addr; - /* The above assignment just overwrote the pool entry. Setting the local_addr - pool for the accepted socket back to what it should be. Otherwise all + /* The above assignment just overwrote the pool entry. Setting the local_addr + pool for the accepted socket back to what it should be. Otherwise all allocations for this socket will come from a server pool that is not freed until the process goes down.*/ (*new)->local_addr->pool = p; @@ -314,7 +314,7 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->local_interface_unknown = 1; } - apr_pool_cleanup_register((*new)->pool, (void *)(*new), + apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; } @@ -360,7 +360,7 @@ static apr_status_t wait_for_connect(apr_socket_t *sock) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, +APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { apr_status_t rv; @@ -380,8 +380,8 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, if (rv == APR_FROM_OS_ERROR(WSAEWOULDBLOCK)) { if (sock->timeout == 0) { /* Tell the app that the connect is in progress... - * Gotta play some games here. connect on Unix will return - * EINPROGRESS under the same circumstances that Windows + * Gotta play some games here. connect on Unix will return + * EINPROGRESS under the same circumstances that Windows * returns WSAEWOULDBLOCK. Do some adhoc canonicalization... */ rv = APR_FROM_OS_ERROR(WSAEINPROGRESS); @@ -483,8 +483,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->disconnected = 0; (*apr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, - os_sock_info->local, + memcpy(&(*apr_sock)->local_addr->sa.sin, + os_sock_info->local, (*apr_sock)->local_addr->salen); (*apr_sock)->local_addr->pool = cont; /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ @@ -494,7 +494,7 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*apr_sock)->remote_addr->sa.sin, os_sock_info->remote, (*apr_sock)->remote_addr->salen); (*apr_sock)->remote_addr->pool = cont; @@ -502,8 +502,8 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->remote_addr->port = ntohs((*apr_sock)->remote_addr->sa.sin.sin_port); (*apr_sock)->remote_addr_unknown = 0; } - - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + + apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), socket_cleanup, apr_pool_cleanup_null); return APR_SUCCESS; @@ -533,14 +533,14 @@ APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, * This is not trivial to implement. */ -APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket) -{ +APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket) +{ return APR_ENOTIMPL; -} +} -APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket) -{ +APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket) +{ return APR_ENOTIMPL; -} +} APR_POOL_IMPLEMENT_ACCESSOR(socket); diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index 463eeebf5..780b5bd7b 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -69,15 +69,15 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva apr_set_option(sock, APR_SO_NONBLOCK, 0); } /* Reset socket timeouts if the new timeout differs from the old timeout */ - if (sock->timeout != t) + if (sock->timeout != t) { /* Win32 timeouts are in msec, represented as int */ sock->timeout_ms = (int)apr_time_as_msec(t); - setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, - (char *) &sock->timeout_ms, + setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, + (char *) &sock->timeout_ms, sizeof(sock->timeout_ms)); - setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, - (char *) &sock->timeout_ms, + setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, + (char *) &sock->timeout_ms, sizeof(sock->timeout_ms)); } } @@ -86,9 +86,9 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva /* Set the socket to blocking with infinite timeouts */ if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) return stat; - setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, + setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, (char *) &zero, sizeof(zero)); - setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, + setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDTIMEO, (char *) &zero, sizeof(zero)); } sock->timeout = t; @@ -107,7 +107,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, switch (opt) { case APR_SO_KEEPALIVE: if (on != apr_is_option_set(sock, APR_SO_KEEPALIVE)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -116,7 +116,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_DEBUG: if (on != apr_is_option_set(sock, APR_SO_DEBUG)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -137,7 +137,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_BROADCAST: if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -146,7 +146,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_SO_REUSEADDR: if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -156,7 +156,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, case APR_SO_NONBLOCK: if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { - if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) + if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) return stat; } else { @@ -172,7 +172,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, struct linger li; li.l_onoff = on; li.l_linger = APR_MAX_SECS_TO_LINGER; - if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) == -1) { return apr_get_netos_error(); } @@ -186,7 +186,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; - if (setsockopt(sock->socketdes, optlevel, optname, + if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { return apr_get_netos_error(); } @@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, break; case APR_IPV6_V6ONLY: #if APR_HAVE_IPV6 - if (apr_os_level < APR_WIN_VISTA && + if (apr_os_level < APR_WIN_VISTA && sock->local_addr->family == AF_INET6) { /* apr_set_option() called at socket creation */ if (on) { |