Commit Graph

58 Commits

Author SHA1 Message Date
Frediano Ziglio
85fc0b5482 vdservice: Print error on standard error, not standard output
Error stream should be used for error reporting, not output one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-12-12 21:35:58 +00:00
Frediano Ziglio
14769f88c9 vdservice: Do not append line terminator to log
vd_printf already add a line terminator

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-29 18:51:06 +01:00
Frediano Ziglio
f00fe84cc3 Prevent possible future buffer overflow
event_type should come only with specific values but
this in theory can change in the future.
To prevent overflows (just for logging) check value size
against lookup array.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2017-07-26 08:52:15 +01:00
Frediano Ziglio
cf7a929655 Use single variable for path computations
This saves some stack memory not reducing any readability.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-21 14:59:55 +01:00
Frediano Ziglio
b15e525702 Split long if statement
Instead of having a long if statement with checks and assignment
split in two.
The conditions where used to compute 2 different path, this does
not help much with code readability.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2017-07-19 13:10:31 +01:00
Frediano Ziglio
b2c8665777 Store agent process handle instead of using PROCESS_INFORMATION
We just need the handle of the process.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-08 08:23:20 +01:00
Frediano Ziglio
babef14b8c Use process handle to mark agent existence
Avoid extra field that could be out of sync.
Having a valid process handle is enough.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-08 08:23:18 +01:00
Frediano Ziglio
143f6e55ee Close agent thread handle
This is not needed so we can close it

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-08 08:23:16 +01:00
Frediano Ziglio
cf829d09ef Make some functions static
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-08 08:22:36 +01:00
Uri Lublin
6d2ccaf7d2 vdservice: drop "RHEV" from service name
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-12-22 20:14:37 +02:00
Frediano Ziglio
75a0033f42 Use simpler classes for mutex handling
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01 15:50:14 +01:00
Frediano Ziglio
89445cd1b4 Make session_events static and const
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01 15:46:50 +01:00
Frediano Ziglio
efcd07af8b Avoid to use _singleton for VDService
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16 15:43:23 +01:00
Frediano Ziglio
2a2390df7e Pass class pointer using control context
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-16 15:43:13 +01:00
Frediano Ziglio
724635e1f3 Use proper delete for _events member
Use delete[] to free an array.
This could potentially lead to memory errors depending
on compiler/library implementation.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-08-12 15:35:47 +01:00
Arnon Gilboa
661e18fcf4 vdservice: add quotes to service path
for the case path contains a space, see CreateService() doc:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682450.aspx

rhbz #918635
2013-04-22 11:17:42 +03:00
Arnon Gilboa
877e52386e vdservice: extract supported_system_version() to vdcommon
rhbz #919451 preparation
2013-03-18 12:54:04 +02:00
Arnon Gilboa
c1807e8040 vdservice: reset vdagent stop event after wait
vdagent terminates when the global event is set by vdservice. vdservice is also
responsible to reset the event in any case, without trusting vdagent to do so.
Otherwise, it may terminate the following vdagent instance immediately as well.

Regression was due to commit 2d03cc.

rhbz #868254
2013-02-26 17:58:44 +02:00
Arnon Gilboa
2d03cc5c2c vdservice stops vdagent via event
Terminate agent politely instead of ugly TerminateProcess(), so now
VD_AGENT_CLIPBOARD_RELEASE is sent (if guest owned the clipboard),
followed by cleanup.

rhbz #903379
2013-01-31 11:34:14 +02:00
Arnon Gilboa
c18859ff35 vdservice: set process handle for vdagent launched on session>0
The problem on XP was failing to terminate agent running on session>0,
since during agent process creation, a handle was not set, so it was NULL.
Therefore, the new agent created (at the session we switched to) was unable
to open vitio-serial which was still used by the other running agent instance.

rhbz#868254
2012-11-25 17:11:39 +02:00
Arnon Gilboa
e5c363b841 vdservice: support Windows 8 & Server 2012
vdagent was ok, but vdservice required adding these to the version check.
Both are handled as the rest of the Win7 class.
Tested on Win8x64.
2012-11-25 10:11:59 +02:00
Arnon Gilboa
9f44263959 vdservice: remove virtio-serial & pipe usage 2012-11-14 10:50:50 +02:00
Arnon Gilboa
4929cb36f2 vdservice: stop service on virtio failure
read & write are async, and their completion is handled by handle_event(),
which returns status used by service execute loop.
previously an error in GetOverlappedResult caused vdservice hang.

rhbz#839564
2012-09-16 11:48:09 +03:00
Arnon Gilboa
18f70a3376 vdservice: restart vdagent if killed manually
win7-only issue

rhbz#845222
2012-09-10 10:59:14 +03:00
Marc-André Lureau
04a28a35ed Fix remaining warnings 2012-07-25 11:27:22 +02:00
Marc-André Lureau
cee350027f mingw: fix broken build
Add missing declaration left-over.
2012-05-24 19:03:48 +02:00
Marc-André Lureau
2ab4fb7832 Allow running as a normal process again
The service code should be commented out if DEBUG_VDSERVICE.
Otherwise it fails to run as a standalone process.
2012-05-24 13:55:31 +02:00
Marc-André Lureau
b4b7105c57 mingw: add standard main() entry function
Thanks Paolo for the suggestion:
http://lists.freedesktop.org/archives/spice-devel/2012-May/009291.html
2012-05-24 13:53:43 +02:00
Christophe Fergeau
74af857e8e Revert "mingw: remove tMain use"
This patch wasn't sent for review, and wasn't meant to be pushed
as part of the mingw series

This reverts commit 63541ea6ac.
2012-03-01 16:58:18 +01:00
Christophe Fergeau
63541ea6ac mingw: remove tMain use
mingw does not support it.
2012-03-01 12:59:05 +01:00
Christophe Fergeau
bc99951685 mingw: use unsigned int in for loops when needed
gcc complains about mixed use of signed/unsigned otherwise
2012-03-01 12:59:05 +01:00
Christophe Fergeau
df3fe9cb90 mingw: fix format string warnings
Most of them are caused by not using %lu to print a DWORD (which
is an unsigned long).
2012-02-23 19:03:25 +01:00
Christophe Fergeau
8ca8687fcc Fix = use instead of ==
When checking for ConnectNamedPipe status, the error check uses
if ( err = ERROR_IO_PENDING) instead of using == which causes this
error check to always trigger. This commit fixes this, however it
needs careful testing since the fact that it went unnoticed means
the code with the bug was working as expected. Maybe changing it
will cause unexpected regressions.
2012-02-23 18:55:24 +01:00
Arnon Gilboa
56f7f3f1d5 vdservice: fix vdagent first launch (during startup) failure handling rhbz#750037
In case of agent launch failure: if connection state is not active(*), wait for
agent launch on the next session connection. Otherwise, the service is stopped.
(*) The failure was due to system startup timings and logon settings, causing
the first agent instance lifetime (before session connect) to be too short to
connect the service.
2011-12-28 16:27:18 +02:00
Arnon Gilboa
5ffb111944 vdservice: fix vdagent connection & termination handling rhbz#750037
-extend vdagent wait timeouts
-timeout occured when connecting during windows startup, using wan emulator with
1Mbps bandwith, and only when qxl driver is installed. It might be due to spice
commands window control which in this case indirectly affects windows startup
timings (needs further investigation).
-fix wait for vdagent connect
-fix wait for vdagent termination & exit code handling
-cleanup & nicify relevant logs while debugging
2011-11-16 12:03:21 +02:00
Arnon Gilboa
5edb588d6f vdservice: extract init_vdi_port() 2011-07-24 18:08:03 +03:00
Arnon Gilboa
407acb2288 vdservice: clean agent proc handle in kill_agent()
fill_agent_events() will not add it to the events used by WaitFor(),
preventing usage of a dead process handle.
2011-07-24 18:08:02 +03:00
Arnon Gilboa
e0a75c9042 vdservice: use overlap ConnectNamedPipe() in launch_agent()
passing NULL is buggy when pipe opened with FILE_FLAG_OVERLAPPED
2011-07-24 18:07:46 +03:00
Arnon Gilboa
f1bc45e53b vdservice: add control events RHBZ #719140 #722980
-prevent race between service control manager (SCM) & the service main thread.
-use events for stop, logon, agent restart.
-thread-safe control command queue
2011-07-24 17:53:59 +03:00
Arnon Gilboa
0d43d537c6 vdservice: support w2k3 32/64/r2, w2k8 32/64/r2 (rhbz#683166) 2011-04-28 11:08:57 +03:00
Arnon Gilboa
bc74bd6e79 vdservice: don't close pipe if overlapped I/O event is not in signaled state (rhbz#667777)
which is beacuse ReadFile completed successfully without pending and the data was already consumed
2011-04-28 11:08:48 +03:00
Alon Levy
0f92cbea70 vdi_port refactor: introduce old pci_vdi_port
This patch is a little dirty due to EOL convertion to windows format.

 + add pci_vdi_port with PCIVDIPort taken from last commit before
  changing to virtio-serial (a17ccbf323)
 + move handle_error to VDIPort (identical in VIRTIOVDIPort and PCIVDIPort)
 + make VDService create first a virtio, then init, the pci, then init,
  stopping when the first init succeeds, and reporting to log which was
  created.
2011-01-11 17:18:47 +02:00
Alon Levy
935330f996 vdi_port refactor: move ring handling to VDIPort, split h file, remove some debug prints 2011-01-11 17:18:02 +02:00
Alon Levy
904b0860b3 vdi_port refactor: introduce interface
make VDIPort an abstract class.
rename old VDIPort VirtioVDIPort.
h file for virtio_vdi_port will be introduced later.
2011-01-11 17:17:47 +02:00
Alon Levy
842950d67c start refactoring vdi_port
introduce VDIPort::get_num_events and VDIPort::fill_events,
change VDService::_events to be dynamically allocated
document _events contents: STATIC events, then vdi_port, then agent.
2011-01-11 17:17:18 +02:00
Arnon Gilboa
35d1b7c835 Revert "vdservice: don't start when no qxl device present"
This reverts commit 349e6a5bf8 which breaks vsdervice on Windows 7
2010-11-09 20:50:21 +02:00
Arnon Gilboa
d3154e89a2 vdservice: replace VDAgentDataChunk with VDIChunkHeader 2010-09-21 19:03:09 +02:00
Alon Levy
349e6a5bf8 vdservice: don't start when no qxl device present 2010-08-24 14:56:28 +03:00
Yonit Halperin
5833dc9760 Controlling Windows display settings (e.g., wallpaper, UI effects and font smoothing)
The configuration is received from Spice client.
The main usage of this option is for disabling display features in order to accelerate Spice performance over limited network connections.
2010-08-24 10:36:05 +03:00
Arnon Gilboa
81cd5620d2 vdservice/vdagent: fixes leading to clipboard (aka large) message handling
-add VDAgent::dispatch_message()
-in VDAgent::read_completion() handle multi-chunk msgs
-fix chunk size bug in VDService::handle_pipe_data()
-add size to VDPipeMessage
2010-08-23 18:54:25 +03:00