#include "squid-old.h"
#include "base/AsyncCall.h"
#include "StoreIOBuffer.h"
+#include "compat/cmsg.h"
#include "comm.h"
#include "event.h"
#include "fde.h"
ssize_t
comm_udp_send(int s, const void *buf, size_t len, int flags)
{
- return Squid::send(s, buf, len, flags);
+ return Squid::send(s, static_cast<const char *>(buf), len, flags);
}
commSetReuseAddr(new_socket);
if (addr.GetPort() > (unsigned short) 0) {
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (sock_type != SOCK_DGRAM)
#endif
commSetNoLinger(new_socket);
fd_table[conn->fd].flags.close_on_exec = 1;
if (conn->local.GetPort() > (unsigned short) 0) {
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
if (AI->ai_socktype != SOCK_DGRAM)
#endif
fd_table[conn->fd].flags.nolinger = 1;
int
commSetNonBlocking(int fd)
{
-#if !_SQUID_MSWIN_
+#if !_SQUID_WINDOWS_
int flags;
int dummy = 0;
#endif
} else {
#endif
#endif
-#if !_SQUID_MSWIN_
+#if !_SQUID_WINDOWS_
- if ((flags = Squid::fcntl(fd, F_GETFL, dummy)) < 0) {
+ if ((flags = fcntl(fd, F_GETFL, dummy)) < 0) {
debugs(50, 0, "FD " << fd << ": fcntl F_GETFL: " << xstrerror());
return COMM_ERROR;
}
int
commUnsetNonBlocking(int fd)
{
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
int nonblocking = FALSE;
if (ioctlsocket(fd, FIONBIO, (unsigned long *) &nonblocking) < 0) {
{
/* Initialize done pipe signal */
int DonePipe[2];
- if (pipe(DonePipe)) {}
+ if (Squid::pipe(DonePipe)) {}
DoneFD = DonePipe[1];
DoneReadFD = DonePipe[0];
fd_open(DoneReadFD, FD_PIPE, "async-io completetion event: main");
int default_read_method(int, char *, int);
int default_write_method(int, const char *, int);
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
int socket_read_method(int, char *, int);
int socket_write_method(int, const char *, int);
int file_read_method(int, char *, int);
*F = fde();
}
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
int
socket_read_method(int fd, char *buf, int len)
{
int i;
PROF_start(send);
- i = send(fd, (const void *) buf, len, 0);
+ i = Squid::send(fd, buf, len, 0);
PROF_stop(send);
return i;
}
F->type = type;
F->flags.open = 1;
F->epoll_state = 0;
-#if _SQUID_MSWIN_
+#if _SQUID_WINDOWS_
F->win32.handle = _get_osfhandle(fd);
#include "squid-old.h"
#include "comm.h"
+#include "comm/Connection.h" /* for COMM_* */
#include "fde.h"
#include "ip/Address.h"
#include "rfc1738.h"
return ipcCloseAllFD(prfd, pwfd, -1, -1);
}
- x = send(pwfd, (const void *)ok_string, strlen(ok_string), 0);
+ x = Squid::send(pwfd, ok_string, strlen(ok_string), 0);
if (x < 0) {
debugs(54, 0, "ipcCreate: PARENT: OK write test failed");
{
int x;
- x = send(cwfd, (const void *)buf, len, 0);
+ x = Squid::send(cwfd, buf, len, 0);
if (x < 0) {
debugs(54, 0, "sendto FD " << cwfd << ": " << xstrerror());
goto cleanup;
}
- x = send(cwfd, (const void *)hello_string, strlen(hello_string) + 1, 0);
+ x = Squid::send(cwfd, hello_string, strlen(hello_string) + 1, 0);
if (x < 0) {
debugs(54, 0, "sendto FD " << cwfd << ": " << xstrerror());
goto cleanup;
}
- x = send(pwfd_ipc, (const void *)ok_string, strlen(ok_string), 0);
+ x = Squid::send(pwfd_ipc, ok_string, strlen(ok_string), 0);
x = recv(prfd_ipc, (void *)(buf1 + 200), 8191 - 200, 0);
assert((size_t) x == strlen(ok_string)
&& !strncmp(ok_string, buf1 + 200, strlen(ok_string)));
if (type == IPC_TCP_SOCKET)
x = write(c2p[1], buf1, x);
else
- x = send(pwfd_ipc, (const void *)buf1, x, 0);
+ x = Squid::send(pwfd_ipc, buf1, x, 0);
if (x <= 0) {
debugs(54, 3, "ipc(" << prog << "," << pid << "): " << x << " bytes written to " << prog << ". Exiting...");
ipcCloseAllFD(-1, -1, crfd, cwfd);
if (prfd_ipc != -1) {
- send(crfd_ipc, (const void *)shutdown_string, strlen(shutdown_string), 0);
+ Squid::send(crfd_ipc, shutdown_string, strlen(shutdown_string), 0);
shutdown(crfd_ipc, SD_BOTH);
shutdown(prfd_ipc, SD_BOTH);
}
debugs(54, 5, "ipc(" << prog << "," << pid << "): received from child : " << rfc1738_escape_unescaped(buf2));
- x = send(send_fd, (const void *)buf2, x, 0);
+ x = Squid::send(send_fd, buf2, x, 0);
if ((x <= 0 && type == IPC_TCP_SOCKET) ||
(x < 0 && type == IPC_UDP_SOCKET)) {