From cde6c2e042834d66649308093d5522c1a2001949 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 5 Aug 2014 18:04:46 +0200 Subject: Fix build of test port program --- erts/emulator/test/async_ports_SUITE_data/cport.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'erts/emulator/test/async_ports_SUITE_data/cport.c') diff --git a/erts/emulator/test/async_ports_SUITE_data/cport.c b/erts/emulator/test/async_ports_SUITE_data/cport.c index 179cdc4b8b..033aff382a 100644 --- a/erts/emulator/test/async_ports_SUITE_data/cport.c +++ b/erts/emulator/test/async_ports_SUITE_data/cport.c @@ -1,9 +1,13 @@ #include #include -#include #include #include -#include +#ifdef __WIN32__ +# include "windows.h" +# include "winbase.h" +#else +# include +#endif typedef unsigned char byte; @@ -53,13 +57,25 @@ int write_exact(byte *buf, int len) return len; } +byte static_buf[31457280]; // 30 mb + int main(int argc, char **argv) { int sleep_time = atoi(argv[1]); int fn, arg, res; - byte *buf = malloc(31457280); // 30 mb + byte *buf = &static_buf[0]; int len = 0; + if (sleep_time <= 0) + sleep_time = 0; +#ifdef __WIN32__ + else + sleep_time = ((sleep_time - 1) / 1000) + 1; /* Milli seconds */ +#endif while ((len = read_cmd(buf)) > 0) { +#ifdef __WIN32__ + Sleep((DWORD) sleep_time); +#else usleep(sleep_time); +#endif write_cmd(buf, len); } } -- cgit v1.2.3