Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVPath upstream for mingw #4289

Merged
merged 7 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/.indent.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-nbad -bap -nbc -br -c33 -cd33 -ncdb -ce -ci4 -brs
-cli0 -cp33 -d0 -di1 -fc1 -fca -i4 -ip0 -l75 -lp
-cli0 -cp33 -d0 -di1 -fc1 -fca -i4 -ip0 -l120 -lp
-npcs -psl -sc -nsob -nss -ts8 -TIOFile -TIOFormat -TIOConversionPtr
-TIOFieldList -TIORecordType -TIOFieldPtr
25 changes: 16 additions & 9 deletions thirdparty/EVPath/EVPath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5)
# GTKorvo
set(CMAKE_DIRECTORY_LABELS EVPath)

project(EVPath VERSION 4.5.1 LANGUAGES C CXX)
project(EVPath VERSION 4.5.3 LANGUAGES C CXX)

# Enable <PackageName>_ROOT variables for dependency searching
# CMake v3.12
Expand Down Expand Up @@ -297,10 +297,13 @@ if(EVPATH_TRANSPORT_MODULES)

add_library(cmselect MODULE cmselect.c)
add_library(cmsockets MODULE cmsockets.c ip_config.c)
add_library(cmudp MODULE cmudp.c)
add_library(cmmulticast MODULE cmmulticast.c)

foreach(M cmselect cmsockets cmudp cmmulticast)
list (APPEND tgts cmselect cmsockets)
if(NOT WIN32)
add_library(cmudp MODULE cmudp.c)
add_library(cmmulticast MODULE cmmulticast.c)
list (APPEND tgts cmudp cmmulticast)
endif()
foreach(M ${tgts})
set_target_properties(${M} PROPERTIES
OUTPUT_NAME ${EVPATH_LIBRARY_PREFIX}${M}
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${EVPATH_INSTALL_MODULE_DIR}
Expand All @@ -310,10 +313,12 @@ if(EVPATH_TRANSPORT_MODULES)

target_link_libraries(cmselect PRIVATE evpath_headers atl::atl)
target_link_libraries(cmsockets PRIVATE evpath_headers atl::atl)
target_link_libraries(cmudp PRIVATE evpath_headers atl::atl)
target_link_libraries(cmmulticast PRIVATE evpath_headers atl::atl)

list(APPEND EVPATH_TRANSPORT_TARGETS cmselect cmsockets cmudp cmmulticast)
list(APPEND EVPATH_TRANSPORT_TARGETS cmselect cmsockets)
if(NOT WIN32)
target_link_libraries(cmudp PRIVATE evpath_headers atl::atl)
target_link_libraries(cmmulticast PRIVATE evpath_headers atl::atl)
list (APPEND EVPATH_TRANSPORT_TARGETS cmudp cmmulticast)
endif()

if (HAVE_SYS_EPOLL_H)
add_library(cmepoll MODULE cmepoll.c)
Expand Down Expand Up @@ -604,6 +609,8 @@ CHECK_INCLUDE_FILE(hostlib.h HAVE_HOSTLIB_H)
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H)
CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H)
CHECK_INCLUDE_FILE(sockLib.h HAVE_SOCKLIB_H)
CHECK_INCLUDE_FILE(stdarg.h STDC_HEADERS)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/chr_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef _MSC_VER
#ifdef _WIN32
#include <winsock2.h>
#include <time.h>
#include <sys/timeb.h>
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/EVPath/EVPath/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <stdlib.h>
#include <limits.h>
#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#define __ANSI_CPP__
#define lrand48() rand()
Expand Down Expand Up @@ -3981,7 +3983,7 @@ int offset_compare(const void* lhsv, const void* rhsv)
return lhs->offset.tv_usec - rhs->offset.tv_usec;
}

#ifdef _MSC_VER
#ifdef _WIN32
static inline void timeradd(struct timeval *a, struct timeval *b,
struct timeval *res)
{
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cm_evol.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#endif
#include <stdlib.h>
#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cm_pbio.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#endif
#include <string.h>
#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#else
#include <netinet/in.h>
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cm_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#endif
#include <stdlib.h>
#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#define __ANSI_CPP__
#else
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/EVPath/EVPath/cm_schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
extern "C" {
#endif

#ifdef _MSC_VER
#ifdef _WIN32
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#endif
typedef struct _avail_period {
Expand Down
25 changes: 9 additions & 16 deletions thirdparty/EVPath/EVPath/cmdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ typedef struct _nested_rec {
complex item;
} nested, *nested_ptr;

static IOField nested_field_list[] =
{
static IOField nested_field_list[] = {
{"item", "complex", sizeof(complex), IOOffset(nested_ptr, item)},
{NULL, NULL, 0, 0}
};

static IOField complex_field_list[] =
{
static IOField complex_field_list[] = {
{"r", "double", sizeof(double), IOOffset(complex_ptr, r)},
{"i", "double", sizeof(double), IOOffset(complex_ptr, i)},
{NULL, NULL, 0, 0}
Expand All @@ -48,8 +46,7 @@ typedef struct _simple_rec {
int scan_sum;
} simple_rec, *simple_rec_ptr;

static IOField simple_field_list[] =
{
static IOField simple_field_list[] = {
{"integer_field", "integer",
sizeof(int), IOOffset(simple_rec_ptr, integer_field)},
{"short_field", "integer",
Expand All @@ -67,15 +64,14 @@ static IOField simple_field_list[] =
{NULL, NULL, 0, 0}
};

static CMFormatRec simple_format_list[] =
{
static CMFormatRec simple_format_list[] = {
{"complex", complex_field_list},
{"nested", nested_field_list},
{NULL, NULL}
};

static
void
void
generate_record(event)
simple_rec_ptr event;
{
Expand Down Expand Up @@ -103,7 +99,7 @@ simple_rec_ptr event;
int quiet = -1;

static
void
void
simple_handler(cm, conn, vevent, client_data, attrs)
CManager cm;
CMConnection conn;
Expand All @@ -123,8 +119,7 @@ attr_list attrs;
sum = sum % 100;
scan_sum = event->scan_sum;
if (sum != scan_sum) {
printf("Received record checksum does not match. expected %d, got %d\n",
(int) sum, (int) scan_sum);
printf("Received record checksum does not match. expected %d, got %d\n", (int) sum, (int) scan_sum);
}
if ((quiet <= 0) || (sum != scan_sum)) {
printf("In the handler, event data is :\n");
Expand Down Expand Up @@ -168,8 +163,7 @@ char **argv;
CMlisten_specific(cm, listen_list);
contact_list = CMget_contact_list(cm);
printf("Contact list \"%s\"\n", attr_list_to_string(contact_list));
format = CMregister_format(cm, "simple", simple_field_list,
simple_format_list);
format = CMregister_format(cm, "simple", simple_field_list, simple_format_list);
CMregister_handler(format, simple_handler, NULL);
CMsleep(cm, 120);
} else {
Expand All @@ -186,8 +180,7 @@ char **argv;
exit(1);
}
}
format = CMregister_format(cm, "simple", simple_field_list,
simple_format_list);
format = CMregister_format(cm, "simple", simple_field_list, simple_format_list);
generate_record(&data);
attrs = create_attr_list();
#define CMDEMO_TEST_ATOM ATL_CHAR_CONS('C','\115','\104','t')
Expand Down
9 changes: 6 additions & 3 deletions thirdparty/EVPath/EVPath/cmenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

#undef NDEBUG
#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#include <process.h>
Expand Down Expand Up @@ -39,8 +41,12 @@
#ifdef HAVE_STREAMS_UN_H
#include <streams/un.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
Expand Down Expand Up @@ -189,9 +195,6 @@ extern void ZPLENETdummy() { // for warning suppression
#define INTERFACE_NAME(NAME) libcmenet_LTX_ ## NAME
#include <enet/enet.h>
#endif
#ifndef _MSC_VER
#include <arpa/inet.h>
#endif
#include <time.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cmepoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#include <sys/timeb.h>
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cmib.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#define getpid() _getpid()
Expand Down
8 changes: 6 additions & 2 deletions thirdparty/EVPath/EVPath/cmmulticast.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <ws2ipdef.h>
#include <windows.h>
#define getpid() _getpid()
#define close(x) closesocket(x)
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
Expand Down Expand Up @@ -60,6 +60,10 @@
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#ifdef _WIN32
#define getpid() _getpid()
#define close(x) closesocket(x)
#endif

#include <atl.h>
#include "evpath.h"
Expand Down
2 changes: 2 additions & 0 deletions thirdparty/EVPath/EVPath/cmselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#include <sys/timeb.h>
Expand Down
6 changes: 4 additions & 2 deletions thirdparty/EVPath/EVPath/cmsockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#include <process.h>
Expand Down Expand Up @@ -856,7 +858,7 @@ static void
set_block_state(CMtrans_services svc, socket_conn_data_ptr scd,
socket_block_state needed_block_state)
{
#ifndef _MSC_VER
#ifndef _WIN32
int fdflags = fcntl(scd->fd, F_GETFL, 0);
if (fdflags == -1) {
perror("getflags\n");
Expand Down Expand Up @@ -906,7 +908,7 @@ extern ssize_t
libcmsockets_LTX_read_to_buffer_func(CMtrans_services svc, socket_conn_data_ptr scd, void *buffer, ssize_t requested_len, int non_blocking)
{
ssize_t left, iget;
#ifndef _MSC_VER
#ifndef _WIN32
// GSE
int fdflags = fcntl(scd->fd, F_GETFL, 0);
if (fdflags == -1) {
Expand Down
8 changes: 6 additions & 2 deletions thirdparty/EVPath/EVPath/cmudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
#include <sys/types.h>

#ifdef HAVE_WINDOWS_H
#ifndef FD_SETSIZE
#define FD_SETSIZE 1024
#endif
#include <winsock2.h>
#include <windows.h>
#define getpid() _getpid()
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
Expand Down Expand Up @@ -59,6 +60,9 @@
#include <memory.h>
#endif

#ifdef _WIN32
#define getpid() _getpid()
#endif
#include <atl.h>
#include "evpath.h"
#include "cm_transport.h"
Expand Down Expand Up @@ -627,7 +631,7 @@ libcmudp_LTX_writev_func(CMtrans_services svc, udp_conn_data_ptr ucd, struct iov
fd = ucd->utd->socket_fd;
svc->trace_out(ucd->utd->cm, "CMUdp writev of %d vectors on fd %d",
iovcnt, fd);
#ifndef _MSC_VER
#ifndef _WIN32
struct sockaddr_in addr = ucd->dest_addr;
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
Expand Down
6 changes: 6 additions & 0 deletions thirdparty/EVPath/EVPath/config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
/* Define to 1 if you have the <netdb.h> header file. */
#cmakedefine HAVE_NETDB_H

/* Define to 1 if you have the <netinet/in.h> header file. */
#cmakedefine HAVE_NETINET_IN_H

/* Define to 1 if you have the <arpa/inet.h> header file. */
#cmakedefine HAVE_ARPA_INET_H

/* Define to 1 if you have the <stdarg.h> header file. */
#cmakedefine HAVE_STDARG_H

Expand Down
6 changes: 5 additions & 1 deletion thirdparty/EVPath/EVPath/dlloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "dlloader.h"

static char **search_list = NULL;
#ifdef _MSC_VER
#ifdef _WIN32
#include <windows.h>

static struct {
Expand Down Expand Up @@ -57,7 +57,11 @@ void* dlsym(void* handle, const char* name)
return (void*)(intptr_t)fp;
}

#ifndef DLFCN_EXPORT
const char* dlerror(void)
#else
DLFCN_EXPORT char* dlerror(void)
#endif
{
static char errstr[88];

Expand Down
Loading