* Copyright(c) 2020 Intel Corporation
*/
+#ifndef RTE_EXEC_ENV_WINDOWS
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <pthread.h>
+#endif /* !RTE_EXEC_ENV_WINDOWS */
/* we won't link against libbsd, so just always use DPDKs-specific strlcpy */
#undef RTE_USE_LIBBSD
register_client(const char *cmd __rte_unused, const char *params,
char *buffer __rte_unused, int buf_len __rte_unused)
{
+#ifndef RTE_EXEC_ENV_WINDOWS
pthread_t th;
char data[BUF_SIZE];
int fd;
struct sockaddr_un addrs;
+#endif /* !RTE_EXEC_ENV_WINDOWS */
if (!strchr(params, ':')) {
fprintf(stderr, "Invalid data\n");
return -1;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
strlcpy(data, strchr(params, ':'), sizeof(data));
memcpy(data, &data[strlen(":\"")], strlen(data));
if (!strchr(data, '\"')) {
}
pthread_create(&th, NULL, &legacy_client_handler,
(void *)(uintptr_t)fd);
+#endif /* !RTE_EXEC_ENV_WINDOWS */
return 0;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
+
static int
send_error_response(int s, int err)
{
int ret;
char buffer_recv[BUF_SIZE];
/* receive data is not null terminated */
- int bytes = read(s, buffer_recv, sizeof(buffer_recv));
+ int bytes = read(s, buffer_recv, sizeof(buffer_recv) - 1);
while (bytes > 0) {
buffer_recv[bytes] = 0;
if (ret < 0)
printf("\nCould not send error response\n");
}
- bytes = read(s, buffer_recv, sizeof(buffer_recv));
+ bytes = read(s, buffer_recv, sizeof(buffer_recv) - 1);
}
close(s);
return NULL;
}
+
+#endif /* !RTE_EXEC_ENV_WINDOWS */