[Spice-devel] [PATCH spice-server 2/2] reds_stat: Use EXIT_SUCCESS/EXIT_FAILURE for program result

2018-12-22 Thread Frediano Ziglio
-1 is not much portable and standard. Signed-off-by: Frediano Ziglio --- tools/reds_stat.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/reds_stat.c b/tools/reds_stat.c index 3110afb4..1e83bf10 100644 --- a/tools/reds_stat.c +++ b/tools/reds_stat.c @@ -88,7 +8

[Spice-devel] [PATCH spice-server 1/2] reds_stat: Print errors on standard error, not standard output

2018-12-22 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- tools/reds_stat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/reds_stat.c b/tools/reds_stat.c index 10016fdb..3110afb4 100644 --- a/tools/reds_stat.c +++ b/tools/reds_stat.c @@ -101,7 +101,7 @@ int main(int argc, char **argv)

Re: [Spice-devel] [PATCH spice-server 04/33] Avoids %m in formatting for Windows

2018-12-22 Thread Frediano Ziglio
> > Hi > > On Sat, Dec 22, 2018 at 5:49 PM Frediano Ziglio wrote: > > > > > > > > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio > > > wrote: > > > > > > > > Not supported. > > > > > > > > Signed-off-by: Frediano Ziglio > > > > -- > > > > TODO find a better solution > > > > > > May be unneces

Re: [Spice-devel] [PATCH spice-server 06/33] sys-socket: Add socket_newpair utility

2018-12-22 Thread Frediano Ziglio
> > Hi > > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > > > Allows to easier port socketpair. > > Windows does not have this function, we need to create a pair > > using 2 internet sockets and connecting one to the other. > > Have you considered namedpipes instead? > Yes, is tru

Re: [Spice-devel] [PATCH spice-gtk 1/3] meson: use 0.49 support for pie

2018-12-22 Thread Frediano Ziglio
> > From: Marc-André Lureau > > Fixes > WARNING: Use the 'pie' kwarg instead of passing '-fpie' manually to > 'spice-client-glib-usb-acl-helper' > > Signed-off-by: Marc-André Lureau Patch looks good. Technically you can't fix a warning, you remove it. You can "fix" a warning only if this is a

Re: [Spice-devel] [PATCH spice-server 01/33] Use PRIxPTR constant for string formatting

2018-12-22 Thread Frediano Ziglio
> > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > > > These constants are meant to be used in format string for size_t > > types. Use them for portability. > > PRI*PTR is for [u]intptr_t. > > There are some claims that z is supported since VC2015 on stackoverflow. > They are righ

Re: [Spice-devel] [PATCH spice-server 03/33] build: Detect Windows build and change some definitions

2018-12-22 Thread Frediano Ziglio
> Hi > > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > > > Windows needs some specific setting to use network. > > > > Signed-off-by: Frediano Ziglio > > with neat below > Reviewed-by: Marc-André Lureau > > > --- > > configure.ac | 18 +- > > server/Makefi

[Spice-devel] [PATCH spice-gtk 2/3] usb-device-widget: replace deprecated Gtk+ API usage

2018-12-22 Thread marcandre . lureau
From: Marc-André Lureau Use widget properties instead, as recommended in the documentation. The UI doesn't seem to have changed after these modifications. Signed-off-by: Marc-André Lureau --- src/usb-device-widget.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-)

[Spice-devel] [PATCH spice-gtk 3/3] meson: don't link with all dependencies

2018-12-22 Thread marcandre . lureau
From: Marc-André Lureau Split lib dependencies in 3 groups: glib, gtk, and acl. Fixes: https://gitlab.freedesktop.org/spice/spice-gtk/issues/77 Signed-off-by: Marc-André Lureau --- meson.build | 46 ++ src/meson.build | 10 +- 2 files ch

[Spice-devel] [PATCH spice-gtk 1/3] meson: use 0.49 support for pie

2018-12-22 Thread marcandre . lureau
From: Marc-André Lureau Fixes WARNING: Use the 'pie' kwarg instead of passing '-fpie' manually to 'spice-client-glib-usb-acl-helper' Signed-off-by: Marc-André Lureau --- meson.build | 2 +- src/meson.build | 13 +++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git

Re: [Spice-devel] [PATCH spice-server 32/33] Use structure for socket_t type instead of just a typedef

2018-12-22 Thread Frediano Ziglio
> > Hi > > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > Allows the compiler to catch errors mixing int and sockets. > > Make easier to keep Windows port working. > > > > Signed-off-by: Frediano Ziglio > > Ah, I understand the debug code now. > > Still, I think you are being

Re: [Spice-devel] [PATCH spice-server 30/33] Disable recording filtering for Windows

2018-12-22 Thread Frediano Ziglio
> > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > Although this feature can be ported to Windows doing so would > > require the usage of g_spawn_async_with_fds, which is only available > > in GLib 2.58 or some specific Win32 code. > > > > Easy to wrap though: > > https://github

Re: [Spice-devel] [PATCH spice-server 26/33] test-stat: Adjust delay checks

2018-12-22 Thread Frediano Ziglio
> > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > usleep under Windows does not seem to have the required precision. > > Use milliseconds and adjust check times according. > > > > Have you given g_usleep() a try? It has some specific windows handling. > Implementation is Sl

Re: [Spice-devel] [PATCH spice-server 21/33] dispatcher: Port to Windows

2018-12-22 Thread Frediano Ziglio
> > Hi > > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > Replace poll call with select. > > As socket is set to non-blocking we must support it so if > > we detect an EAGAIN error wait for data. > > I am not fond of the two code paths, why not switch the code to select()? > N

Re: [Spice-devel] [PATCH spice-server 20/33] replay: Force binary mode on input on Windows

2018-12-22 Thread Frediano Ziglio
> > On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > If input contains the binary record we can't have it modified > > during read. > > > > Signed-off-by: Frediano Ziglio > > Or the more portable > freopen(NULL, "rb", stdin);? > > anyway > Reviewed-by: Marc-André Lureau > Unfo

Re: [Spice-devel] [PATCH spice-server 18/33] windows: Undefine some conflicting preprocessor macros

2018-12-22 Thread Frediano Ziglio
> On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > > > Signed-off-by: Frediano Ziglio > > I would suggest to wrap with #if _WIN32, otherwise it's really weird > to see those undef without context. > Done, also added a comment like @@ -39,7 +39,10 @@ #include "red-qxl.h" +#ifd

Re: [Spice-devel] [PATCH spice-server 04/33] Avoids %m in formatting for Windows

2018-12-22 Thread Marc-André Lureau
Hi On Sat, Dec 22, 2018 at 5:49 PM Frediano Ziglio wrote: > > > > > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > > > > > Not supported. > > > > > > Signed-off-by: Frediano Ziglio > > > -- > > > TODO find a better solution > > > > May be unnecessary with __USE_MINGW_ANSI_STDIO (to

Re: [Spice-devel] [PATCH spice-server 04/33] Avoids %m in formatting for Windows

2018-12-22 Thread Frediano Ziglio
> > On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > > > Not supported. > > > > Signed-off-by: Frediano Ziglio > > -- > > TODO find a better solution > > May be unnecessary with __USE_MINGW_ANSI_STDIO (to check) > Not sure but this surely would limit the compiler(s?) to MingW only.

Re: [Spice-devel] [PATCH spice-server 25/33] tests: Exclude tests that cannot work on Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > test-stream test is passing file descriptor using Unix socket. > test-stat-file needs some porting work of mmap feature. > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/tests/Makefile.am | 9 +++--

Re: [Spice-devel] [PATCH spice-server 32/33] Use structure for socket_t type instead of just a typedef

2018-12-22 Thread Marc-André Lureau
Hi On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Allows the compiler to catch errors mixing int and sockets. > Make easier to keep Windows port working. > > Signed-off-by: Frediano Ziglio Ah, I understand the debug code now. Still, I think you are being overzealous. Please just us

Re: [Spice-devel] [PATCH spice-server 31/33] replay: Port to Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Client process termination did not work for Windows, used Win32 > APIs. ok.. > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/tests/replay.c | 11 +-- > 1 file changed, 9 insertions(+), 2 del

Re: [Spice-devel] [PATCH spice-server 23/33] tests: Provide alarm replacement for Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/tests/Makefile.am | 2 + > server/tests/test-channel.c | 1 + > server/tests/test-loop.c | 1 + > server/tests/test-stream-device

Re: [Spice-devel] [PATCH spice-server 30/33] Disable recording filtering for Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Although this feature can be ported to Windows doing so would > require the usage of g_spawn_async_with_fds, which is only available > in GLib 2.58 or some specific Win32 code. > Easy to wrap though: https://github.com/elmarco/qemu/commi

Re: [Spice-devel] [PATCH spice-server 29/33] reds: Explicitly include inttypes.h

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > MingW does not include this header while including stdint.h so > on Windows you need to include it. > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/reds.h | 1 + > 1 file changed, 1 insertion(+) > > d

Re: [Spice-devel] [PATCH spice-server 28/33] test-display-base: Port to Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Use GLib function to launch and wait process exit. > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/tests/regression-test.py | 4 ++-- > server/tests/test-display-base.c | 37 +++-

Re: [Spice-devel] [PATCH spice-server 22/33] event-loop: Port to Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Use g_io_channel_win32_new_socket instead of g_io_channel_unix_new > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/event-loop.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/server/eve

Re: [Spice-devel] [PATCH spice-server 26/33] test-stat: Adjust delay checks

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > usleep under Windows does not seem to have the required precision. > Use milliseconds and adjust check times according. > Have you given g_usleep() a try? It has some specific windows handling. > Signed-off-by: Frediano Ziglio > --- >

Re: [Spice-devel] [PATCH spice-server 21/33] dispatcher: Port to Windows

2018-12-22 Thread Marc-André Lureau
Hi On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Replace poll call with select. > As socket is set to non-blocking we must support it so if > we detect an EAGAIN error wait for data. I am not fond of the two code paths, why not switch the code to select()? I wonder if existing poll

Re: [Spice-devel] [PATCH spice-server 24/33] test-listen: Exclude Unix sockets part under Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Windows does not support Unix sockets. > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/tests/test-listen.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/server/tests/test-listen

Re: [Spice-devel] [PATCH spice-server 19/33] windows: Disable code not working on Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > - global signals; > - CLOEXEC flag; > - mmap and statistics; > - IPTOS_LOWDELAY flag; > - Unix sockets; > - sharing file descriptors through Unix sockets; > - TCP_CORK flag. > > Signed-off-by: Frediano Ziglio Looks good, Reviewed-by: Mar

Re: [Spice-devel] [PATCH spice-server 20/33] replay: Force binary mode on input on Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > If input contains the binary record we can't have it modified > during read. > > Signed-off-by: Frediano Ziglio Or the more portable freopen(NULL, "rb", stdin);? anyway Reviewed-by: Marc-André Lureau > --- > server/tests/replay.c |

Re: [Spice-devel] [PATCH spice-server 18/33] windows: Undefine some conflicting preprocessor macros

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:04 PM Frediano Ziglio wrote: > > Signed-off-by: Frediano Ziglio I would suggest to wrap with #if _WIN32, otherwise it's really weird to see those undef without context. > --- > server/red-qxl.c | 1 + > server/reds.c| 3 +++ > 2 files changed, 4 insertions(+) > >

Re: [Spice-devel] [PATCH spice-server 05/33] sys-socket: Introduce some utility to make sockets more portable

2018-12-22 Thread Marc-André Lureau
Hi On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > Between Unix and Windows socket are quite different: > - on Windows sockets have a different namespace from C file > descriptors so you can't use read/write/close or similar functions; > - errors are not stored in errno but you must

Re: [Spice-devel] [PATCH spice-server 06/33] sys-socket: Add socket_newpair utility

2018-12-22 Thread Marc-André Lureau
Hi On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > Allows to easier port socketpair. > Windows does not have this function, we need to create a pair > using 2 internet sockets and connecting one to the other. Have you considered namedpipes instead? > > Signed-off-by: Frediano Ziglio

Re: [Spice-devel] [PATCH spice-server 04/33] Avoids %m in formatting for Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > Not supported. > > Signed-off-by: Frediano Ziglio > -- > TODO find a better solution May be unnecessary with __USE_MINGW_ANSI_STDIO (to check) > --- > server/reds.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/serve

Re: [Spice-devel] [PATCH spice-server 03/33] build: Detect Windows build and change some definitions

2018-12-22 Thread Marc-André Lureau
Hi On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > Windows needs some specific setting to use network. > > Signed-off-by: Frediano Ziglio with neat below Reviewed-by: Marc-André Lureau > --- > configure.ac | 18 +- > server/Makefile.am | 1 + > 2 files chang

Re: [Spice-devel] [PATCH spice-server 01/33] Use PRIxPTR constant for string formatting

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > These constants are meant to be used in format string for size_t > types. Use them for portability. PRI*PTR is for [u]intptr_t. There are some claims that z is supported since VC2015 on stackoverflow. I assume we are mainly interested i

Re: [Spice-devel] [PATCH spice-server 02/33] windows: Do not include headers not available on Windows

2018-12-22 Thread Marc-André Lureau
On Fri, Dec 21, 2018 at 4:03 PM Frediano Ziglio wrote: > > This is a preparatory patch for next portability patches > > Signed-off-by: Frediano Ziglio Reviewed-by: Marc-André Lureau > --- > server/dispatcher.c | 2 ++ > server/net-utils.c | 2 ++ > server/red-cha