Skip to content

Commit

Permalink
Merge branch 'upstream-EVPath' into WindowsStatic
Browse files Browse the repository at this point in the history
# By EVPath Upstream
* upstream-EVPath:
  EVPath 2024-02-21 (6587d0f0)
  • Loading branch information
eisenhauer committed Feb 21, 2024
2 parents 0abfc4e + ef58475 commit 90f0640
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 117 deletions.
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ if (MSVC)
set(EVPATH_USE_ZPL_ENET FALSE)
endif()
if(NOT (DEFINED EVPATH_USE_ZPL_ENET))
option(EVPATH_USE_ZPL_ENET "Build the enet transport" "ON")
option(EVPATH_USE_ZPL_ENET "Build the enet transport" "OFF")
endif()
if(EVPATH_USE_ZPL_ENET)
set(RUN_ZPL_ENET_TESTS TRUE)
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/cmenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ int err;
* NT Sux.
*/

int
static int
pipe(filedes)
SOCKET filedes[2];
{
Expand Down
128 changes: 26 additions & 102 deletions thirdparty/EVPath/EVPath/cmepoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ static char*WSAerror_str(int err);
#endif

static void
init_select_data(svc, sdp, cm)
CMtrans_services svc;
select_data_ptr *sdp;
CManager cm;
init_select_data(CMtrans_services svc, select_data_ptr *sdp, CManager cm)
{
select_data_ptr sd = malloc(sizeof(struct select_data));
*sdp = sd;
Expand Down Expand Up @@ -157,9 +154,7 @@ typedef struct _periodic_task {
} task_handle_s;

static void
free_epoll_data(svc, sdp)
CMtrans_services svc;
select_data_ptr *sdp;
free_epoll_data(CMtrans_services svc, select_data_ptr *sdp)
{
periodic_task_handle tasks;
select_data_ptr sd = *sdp;
Expand All @@ -184,10 +179,7 @@ select_data_ptr *sdp;
((tvp)->tv_usec cmp (uvp)->tv_usec))))

static void
set_soonest_timeout(timeout, task_list, now)
struct timeval *timeout;
periodic_task_handle task_list;
struct timeval now;
set_soonest_timeout(struct timeval *timeout, periodic_task_handle task_list, struct timeval now)
{
struct timeval this_delay;
if (task_list == NULL) return;
Expand All @@ -210,10 +202,7 @@ struct timeval now;
}

static void
increment_time(time, increment_sec, increment_usec)
struct timeval *time;
int increment_sec;
int increment_usec;
increment_time(struct timeval *time, int increment_sec, int increment_usec)
{
time->tv_usec += increment_usec;
time->tv_sec += increment_sec;
Expand All @@ -227,11 +216,7 @@ static void
shutdown_wake_mechanism(select_data_ptr sd);

static void
socket_select(svc, sd, timeout_sec, timeout_usec)
CMtrans_services svc;
select_data_ptr sd;
int timeout_sec;
int timeout_usec;
socket_select(CMtrans_services svc, select_data_ptr sd, int timeout_sec, int timeout_usec)
{
int i, res;
int fd;
Expand Down Expand Up @@ -475,13 +460,7 @@ int timeout_usec;
}

extern void
libcmepoll_LTX_add_select(svc, sdp, fd, func, arg1, arg2)
CMtrans_services svc;
select_data_ptr *sdp;
int fd;
select_list_func func;
void *arg1;
void *arg2;
libcmepoll_LTX_add_select(CMtrans_services svc, select_data_ptr *sdp, int fd, select_list_func func, void *arg1, void *arg2)
{
select_data_ptr sd = *((select_data_ptr *)sdp);
struct epoll_event ep_event;
Expand Down Expand Up @@ -540,13 +519,7 @@ void *arg2;
}

extern void
libcmepoll_LTX_write_select(svc, sdp, fd, func, arg1, arg2)
CMtrans_services svc;
select_data_ptr *sdp;
int fd;
select_list_func func;
void *arg1;
void *arg2;
libcmepoll_LTX_write_select(CMtrans_services svc, select_data_ptr *sdp, int fd, select_list_func func, void *arg1, void *arg2)
{
select_data_ptr sd = *((select_data_ptr *)sdp);
struct epoll_event ep_event;
Expand Down Expand Up @@ -616,15 +589,7 @@ void *arg2;
}

extern periodic_task_handle
libcmepoll_LTX_add_periodic(svc, sdp, interval_sec, interval_usec,
func, arg1, arg2)
CMtrans_services svc;
select_data_ptr *sdp;
int interval_sec;
int interval_usec;
select_list_func func;
void *arg1;
void *arg2;
libcmepoll_LTX_add_periodic(CMtrans_services svc, select_data_ptr *sdp, int interval_sec, int interval_usec, select_list_func func, void *arg1, void *arg2)
{
select_data_ptr sd = *((select_data_ptr *)sdp);
periodic_task_handle handle = malloc(sizeof(struct _periodic_task));
Expand Down Expand Up @@ -671,15 +636,7 @@ void *arg2;


extern periodic_task_handle
libcmepoll_LTX_add_delayed_task(svc, sdp, delay_sec, delay_usec,
func, arg1, arg2)
CMtrans_services svc;
select_data_ptr *sdp;
int delay_sec;
int delay_usec;
select_list_func func;
void *arg1;
void *arg2;
libcmepoll_LTX_add_delayed_task(CMtrans_services svc, select_data_ptr *sdp, int delay_sec, int delay_usec, select_list_func func, void *arg1, void *arg2)
{
select_data_ptr sd = *((select_data_ptr *)sdp);
periodic_task_handle handle = malloc(sizeof(struct _periodic_task));
Expand Down Expand Up @@ -725,9 +682,7 @@ void *arg2;
}

static int
remove_periodic_task(sd, handle)
select_data_ptr sd;
periodic_task_handle handle;
remove_periodic_task(select_data_ptr sd, periodic_task_handle handle)
{
periodic_task_handle list, last = NULL;
list = sd->periodic_task_list;
Expand Down Expand Up @@ -765,10 +720,7 @@ periodic_task_handle handle;


extern void
libcmepoll_LTX_remove_periodic(svc, sdp, handle)
CMtrans_services svc;
select_data_ptr *sdp;
periodic_task_handle handle;
libcmepoll_LTX_remove_periodic(CMtrans_services svc, select_data_ptr *sdp, periodic_task_handle handle)
{
select_data_ptr sd = *((select_data_ptr *)sdp);
if (sd == NULL) return;
Expand All @@ -778,10 +730,7 @@ periodic_task_handle handle;
}

extern void
libcmepoll_LTX_remove_select(svc, sdp, fd)
CMtrans_services svc;
select_data_ptr *sdp;
int fd;
libcmepoll_LTX_remove_select(CMtrans_services svc, select_data_ptr *sdp, int fd)
{
select_data_ptr sd = *((select_data_ptr *)sdp);

Expand Down Expand Up @@ -812,18 +761,15 @@ int fd;
}

static void
shutdown_wake_mechanism(sd)
select_data_ptr sd;
shutdown_wake_mechanism(select_data_ptr sd)
{
if (sd->wake_read_fd == -1) return;
close(sd->wake_read_fd);
close(sd->wake_write_fd);
sd->wake_read_fd = sd->wake_write_fd = -1;
}

static void read_wake_fd(fd_as_ptr, junk)
void *fd_as_ptr;
void *junk;
static void read_wake_fd(void *fd_as_ptr, void *junk)
{
char buffer;
int fd = (int) (long)fd_as_ptr;
Expand All @@ -838,8 +784,7 @@ void *junk;

#ifdef HAVE_WINDOWS_H
static char*
WSAerror_str(err)
int err;
WSAerror_str(int err)
{
switch(err) {
case WSAEINTR: return "WSAEINTR";
Expand Down Expand Up @@ -900,9 +845,8 @@ int err;
* NT Sux.
*/

int
pipe(filedes)
int filedes[2];
static int
pipe(int filedes[2])
{

int length;
Expand Down Expand Up @@ -990,9 +934,7 @@ int filedes[2];
#endif

static void
setup_wake_mechanism(svc, sdp)
CMtrans_services svc;
select_data_ptr *sdp;
setup_wake_mechanism(CMtrans_services svc, select_data_ptr *sdp)
{
int filedes[2];

Expand All @@ -1015,18 +957,15 @@ select_data_ptr *sdp;
}

extern void
libcmepoll_LTX_wake_function(svc, sdp)
CMtrans_services svc;
select_data_ptr *sdp;
libcmepoll_LTX_wake_function(CMtrans_services svc, select_data_ptr *sdp)
{
if (*sdp != NULL) {
wake_server_thread(*sdp);
}
}

static void
wake_server_thread(sd)
select_data_ptr sd;
wake_server_thread(select_data_ptr sd)
{
static char buffer = 'W'; /* doesn't matter what we write */
if (sd->wake_write_fd != -1) {
Expand All @@ -1041,9 +980,7 @@ select_data_ptr sd;
}

extern void
libcmepoll_LTX_blocking_function(svc, client_data)
CMtrans_services svc;
void *client_data;
libcmepoll_LTX_blocking_function(CMtrans_services svc, void *client_data)
{
select_data_ptr sd = *((select_data_ptr *)client_data);
if (sd == NULL) {
Expand All @@ -1058,9 +995,7 @@ void *client_data;
}

extern void
libcmepoll_LTX_polling_function(svc, client_data)
CMtrans_services svc;
void *client_data;
libcmepoll_LTX_polling_function(CMtrans_services svc, void *client_data)
{
select_data_ptr sd = *((select_data_ptr *)client_data);
if (sd == NULL) {
Expand All @@ -1075,21 +1010,15 @@ void *client_data;
}

extern void
libcmepoll_LTX_select_initialize(svc, cm, client_data)
CMtrans_services svc;
CManager cm;
void *client_data;
libcmepoll_LTX_select_initialize(CMtrans_services svc, CManager cm, void *client_data)
{
if (*((select_data_ptr *)client_data) == NULL) {
init_select_data(svc, (select_data_ptr*)client_data, cm);
}
}

extern void
libcmepoll_LTX_select_shutdown(svc, cm, client_data)
CMtrans_services svc;
CManager cm;
void *client_data;
libcmepoll_LTX_select_shutdown(CMtrans_services svc, CManager cm, void *client_data)
{
select_data_ptr *sdp = client_data;
select_data_ptr sd = *sdp;
Expand All @@ -1103,10 +1032,7 @@ void *client_data;
}

extern void
libcmepoll_LTX_select_free(svc, cm, client_data)
CMtrans_services svc;
CManager cm;
void *client_data;
libcmepoll_LTX_select_free(CMtrans_services svc, CManager cm, void *client_data)
{
select_data_ptr *sdp = client_data;
select_data_ptr sd = *sdp;
Expand All @@ -1119,9 +1045,7 @@ void *client_data;
}

extern void
libcmepoll_LTX_select_stop(svc, client_data)
CMtrans_services svc;
void *client_data;
libcmepoll_LTX_select_stop(CMtrans_services svc, void *client_data)
{
if (*((select_data_ptr *)client_data) != NULL) {
(*((select_data_ptr*)client_data))->closed = 1;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/cmmulticast.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ libcmmulticast_LTX_writev_func(CMtrans_services svc, mcast_conn_data_ptr mcd, st
}

#ifdef HAVE_WINDOWS_H
int socket_global_init = 0;
static int socket_global_init = 0;
/* Winsock init stuff, ask for ver 1.1 */
static WORD wVersionRequested = MAKEWORD(1, 1);
static WSADATA wsaData;
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/cmselect.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ int err;
* NT Sux.
*/

int
static int
pipe(SOCKET *filedes)
{

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/cmsockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ libcmsockets_LTX_NBwritev_func(CMtrans_services svc, socket_conn_data_ptr scd, v
return init_bytes - left;
}

int socket_global_init = 0;
static int socket_global_init = 0;

#ifdef HAVE_WINDOWS_H
/* Winsock init stuff, ask for ver 2.2 */
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/EVPath/EVPath/cmudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ libcmudp_LTX_writev_func(CMtrans_services svc, udp_conn_data_ptr ucd, struct iov
}

#ifdef HAVE_WINDOWS_H
int socket_global_init = 0;
static int socket_global_init = 0;
/* Winsock init stuff, ask for ver 1.1 */
static WORD wVersionRequested = MAKEWORD(1, 1);
static WSADATA wsaData;
Expand Down
7 changes: 7 additions & 0 deletions thirdparty/EVPath/EVPath/dfg_tests/auto_tree_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include <string.h>

#include "cod.h"
Expand Down Expand Up @@ -71,6 +72,12 @@ be_test_master(int argc, char **argv)
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
sigact.sa_handler = fail_and_die;
sigemptyset(&sigact.sa_mask);
sigaddset(&sigact.sa_mask, SIGALRM);
sigaction(SIGALRM, &sigact, NULL);
alarm(240); /* reset time limit to 4 minutes */
#endif
if (argc == 1) {
Expand Down
7 changes: 7 additions & 0 deletions thirdparty/EVPath/EVPath/dfg_tests/fail_chain_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include "evpath.h"
#include "ev_dfg.h"
#include "test_support.h"
Expand Down Expand Up @@ -140,6 +141,12 @@ be_test_master(int argc, char **argv)
#ifdef HAVE_WINDOWS_H
SetTimer(NULL, 5, 1000, (TIMERPROC) fail_and_die);
#else
struct sigaction sigact;
sigact.sa_flags = 0;
sigact.sa_handler = fail_and_die;
sigemptyset(&sigact.sa_mask);
sigaddset(&sigact.sa_mask, SIGALRM);
sigaction(SIGALRM, &sigact, NULL);
alarm(240); /* reset time limit to 4 minutes */
#endif
if (argc == 1) {
Expand Down
Loading

0 comments on commit 90f0640

Please sign in to comment.