VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/VBoxClient/VBoxClient.h@ 67319

Last change on this file since 67319 was 67319, checked in by vboxsync, 8 years ago

bugref:8533: Additions/x11: fully support VMSVGA
Allow VBoxClient services to daemonise without providing a pidfile.

Up until now VBoxClient service processes would be made into daemons (unless
the user overrid this) if they provided a name for creating a pidfile. We
add an additional member to the service description structure which is a
boolean specifying whether the service should be daemonised anyway. The
vmsvga service does not need a pidfile as it will use guest capability
acquiring to prevent multiple copies running, but should still be a daemon.
As the new structure member is at the end, it will automatically be zero
(false) for existing services which do not set it.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: VBoxClient.h 67319 2017-06-09 13:11:48Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox additions user session daemon.
5 */
6
7/*
8 * Copyright (C) 2006-2016 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef ___vboxclient_vboxclient_h
20# define ___vboxclient_vboxclient_h
21
22#include <VBox/log.h>
23#include <iprt/cpp/utils.h>
24#include <iprt/string.h>
25
26/** Exit with a fatal error. */
27#define VBClFatalError(format) \
28do { \
29 char *pszMessage = RTStrAPrintf2 format; \
30 LogRel(format); \
31 vbclFatalError(pszMessage); \
32} while(0)
33
34/** Exit with a fatal error. */
35extern DECLNORETURN(void) vbclFatalError(char *pszMessage);
36
37/** Call clean-up for the current service and exit. */
38extern void VBClCleanUp();
39
40/** A simple interface describing a service. VBoxClient will run exactly one
41 * service per invocation. */
42struct VBCLSERVICE
43{
44 /** Get the services default path to pidfile, relative to $HOME. Optional */
45 /** @todo Should this also have a component relative to the X server number?
46 */
47 const char *(*getPidFilePath)(void);
48 /** Special initialisation, if needed. @a pause and @a resume are
49 * guaranteed not to be called until after this returns. */
50 int (*init)(struct VBCLSERVICE **ppInterface);
51 /** Run the service main loop */
52 int (*run)(struct VBCLSERVICE **ppInterface, bool fDaemonised);
53 /** Clean up any global resources before we shut down hard. The last calls
54 * to @a pause and @a resume are guaranteed to finish before this is called.
55 */
56 void (*cleanup)(struct VBCLSERVICE **ppInterface);
57 /** Should the service daemonise? Only checked if @a getPidFilePath is NULL. */
58 /** @todo clean this up along with the pidfile handling. */
59 bool fDaemonise;
60};
61
62/** Default handler for various struct VBCLSERVICE member functions. */
63DECLINLINE(int) VBClServiceDefaultHandler(struct VBCLSERVICE **pSelf)
64{
65 RT_NOREF1(pSelf);
66 return VINF_SUCCESS;
67}
68
69/** Default handler for the struct VBCLSERVICE clean-up member function.
70 * Usually used because the service is cleaned up automatically when the user
71 * process/X11 exits. */
72DECLINLINE(void) VBClServiceDefaultCleanup(struct VBCLSERVICE **ppInterface)
73{
74 NOREF(ppInterface);
75}
76
77extern struct VBCLSERVICE **VBClGetClipboardService();
78extern struct VBCLSERVICE **VBClGetSeamlessService();
79extern struct VBCLSERVICE **VBClGetDisplayService();
80extern struct VBCLSERVICE **VBClGetHostVersionService();
81#ifdef VBOX_WITH_DRAG_AND_DROP
82extern struct VBCLSERVICE **VBClGetDragAndDropService();
83#endif /* VBOX_WITH_DRAG_AND_DROP */
84extern struct VBCLSERVICE **VBClCheck3DService();
85extern struct VBCLSERVICE **VBClDisplaySVGAService();
86
87#endif /* !___vboxclient_vboxclient_h */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette