enable build for ocaml bytecode
by Olaf Hering
This is a first attempt to build libguestfs with just a ocaml bytecode
compiler. The three tools written in ocaml will be build only when an
ocamlopt compiler is available.
Olaf
---
Makefile.am | 5 ++++-
configure.ac | 2 ++
ocaml/Makefile.am | 20 +++++++++++++++++---
resize/Makefile.am | 2 +-
sparsify/Makefile.am | 2 +-
sysprep/Makefile.am | 2 +-
6 files changed, 26 insertions(+), 7 deletions(-)
Index: libguestfs-1.20.1/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/Makefile.am
+++ libguestfs-1.20.1/Makefile.am
@@ -74,7 +74,10 @@ if HAVE_PERL
SUBDIRS += perl perl/examples
endif
if HAVE_OCAML
-SUBDIRS += ocaml ocaml/examples
+SUBDIRS += ocaml
+endif
+if HAVE_OCAMLOPT
+SUBDIRS += ocaml/examples
endif
if HAVE_PYTHON
SUBDIRS += python python/examples
Index: libguestfs-1.20.1/configure.ac
===================================================================
--- libguestfs-1.20.1.orig/configure.ac
+++ libguestfs-1.20.1/configure.ac
@@ -865,6 +865,8 @@ AS_IF([test "x$enable_ocaml" != "xno"],
])
AM_CONDITIONAL([HAVE_OCAML],
[test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
+AM_CONDITIONAL([HAVE_OCAMLOPT],
+ [test "x$OCAMLOPT" != "xno" && test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno"])
AM_CONDITIONAL([HAVE_OCAMLDOC],
[test "x$OCAMLDOC" != "xno"])
Index: libguestfs-1.20.1/ocaml/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/ocaml/Makefile.am
+++ libguestfs-1.20.1/ocaml/Makefile.am
@@ -43,10 +43,20 @@ CLEANFILES += t/*.cmi t/*.cmo t/*.cmx t/
if HAVE_OCAML
+DATA_HOOK_FILES = META *.so *.a *.cma \
+ *.cmi $(srcdir)/*.mli
+if HAVE_OCAMLOPT
+DATA_HOOK_FILES += *.cmx *.cmxa
+endif
+
OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
-noinst_DATA = mlguestfs.cma mlguestfs.cmxa META
+noinst_DATA = mlguestfs.cma
+if HAVE_OCAMLOPT
+noinst_DATA += mlguestfs.cmxa
+endif
+noinst_DATA += META
# Build the C part into a library, so that automake handles the C
# compilation step for us. Note that we don't directly use this
@@ -101,9 +111,13 @@ TESTS = run-bindtests \
$(patsubst %,%.opt,$(test_progs)))
noinst_DATA += \
- bindtests.bc bindtests.opt \
+ bindtests.bc
+if HAVE_OCAMLOPT
+noinst_DATA += \
+ bindtests.opt \
$(test_progs:%=%.bc) \
$(test_progs:%=%.opt)
+endif
bindtests.bc: bindtests.cmo mlguestfs.cma
mkdir -p t
@@ -217,7 +231,7 @@ install-data-hook:
$(OCAMLFIND) install \
-ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
guestfs \
- META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
+ $(DATA_HOOK_FILES)
rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
Index: libguestfs-1.20.1/resize/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/resize/Makefile.am
+++ libguestfs-1.20.1/resize/Makefile.am
@@ -40,7 +40,7 @@ SOURCES = \
resize_utils.ml \
resize_utils_tests.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sparsify/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sparsify/Makefile.am
+++ libguestfs-1.20.1/sparsify/Makefile.am
@@ -36,7 +36,7 @@ SOURCES = \
sparsify_gettext.ml \
sparsify_utils.ml
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
Index: libguestfs-1.20.1/sysprep/Makefile.am
===================================================================
--- libguestfs-1.20.1.orig/sysprep/Makefile.am
+++ libguestfs-1.20.1/sysprep/Makefile.am
@@ -86,7 +86,7 @@ SOURCES = \
utils.ml \
utils.mli
-if HAVE_OCAML
+if HAVE_OCAMLOPT
# Note this list must be in dependency order.
OBJECTS = \
10 years, 10 months
[PATCH] sysprep: handle distro specific sysv scripts
by Olaf Hering
Currently firstboot would only work on redhat-based images.
Handle redhat-based, suse-based and debian guests, error out in case of an
unknown distro.
Update firstboot.sh:
- make sure scripts exists and can be executed
- add LSB header to avoid insserv warnings later on
- run script only if called with "start"
Update functions, pass only required options.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
index 97cd8a9..c5296a1 100644
--- a/sysprep/firstboot.ml
+++ b/sysprep/firstboot.ml
@@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
let firstboot_sh = sprintf "\
#!/bin/sh -
+### BEGIN INIT INFO
+# Provides: virt-sysprep
+# Required-Start: $null
+# Should-Start: $all
+# Required-Stop: $null
+# Should-Stop: $all
+# Default-Start: 2 3 5
+# Default-Stop: 0 1 6
+# Short-Description: Start scripts to run once at next boot
+# Description: Start scripts to run once at next boot
+# These scripts run the first time the guest boots,
+# and then are deleted. Output or errors from the scripts
+# are written to ~root/virt-sysprep-firstboot.log.
+### END INIT INFO
+
d=%s/scripts
logfile=~root/virt-sysprep-firstboot.log
-for f in $d/* ; do
- echo '=== Running' $f '===' >>$logfile
- $f >>$logfile 2>&1
- rm $f
-done
+if test \"$1\" = \"start\"
+then
+ for f in $d/* ; do
+ if test -x \"$f\"
+ then
+ echo '=== Running' $f '===' >>$logfile
+ $f >>$logfile 2>&1
+ rm -f $f
+ fi
+ done
+fi
" firstboot_dir
let firstboot_service = sprintf "\
@@ -56,7 +77,7 @@ WantedBy=default.target
let failed fs =
ksprintf (fun msg -> failwith (s_"firstboot: failed: " ^ msg)) fs
-let rec install_service g root =
+let rec install_service g distro =
g#mkdir_p firstboot_dir;
g#mkdir_p (sprintf "%s/scripts" firstboot_dir);
g#write (sprintf "%s/firstboot.sh" firstboot_dir) firstboot_sh;
@@ -64,18 +85,18 @@ let rec install_service g root =
(* systemd, else assume sysvinit *)
if g#is_dir "/etc/systemd" then
- install_systemd_service g root
+ install_systemd_service g
else
- install_sysvinit_service g root
+ install_sysvinit_service g distro
(* Install the systemd firstboot service, if not installed already. *)
-and install_systemd_service g root =
+and install_systemd_service g =
g#write (sprintf "%s/firstboot.service" firstboot_dir) firstboot_service;
g#mkdir_p "/etc/systemd/system/default.target.wants";
g#ln_sf (sprintf "%s/firstboot.service" firstboot_dir)
"/etc/systemd/system/default.target.wants"
-and install_sysvinit_service g root =
+and install_sysvinit_redhat g =
g#mkdir_p "/etc/rc.d/rc2.d";
g#mkdir_p "/etc/rc.d/rc3.d";
g#mkdir_p "/etc/rc.d/rc5.d";
@@ -86,12 +107,51 @@ and install_sysvinit_service g root =
g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
"/etc/rc.d/rc5.d/99virt-sysprep-firstboot"
+(* Make firstboot.sh look like a runlevel script to avoid insserv warnings. *)
+and install_sysvinit_suse g =
+ g#mkdir_p "/etc/init.d/rc2.d";
+ g#mkdir_p "/etc/init.d/rc3.d";
+ g#mkdir_p "/etc/init.d/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "../virt-sysprep-firstboot"
+ "/etc/init.d/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_debian g =
+ g#mkdir_p "/etc/init.d";
+ g#mkdir_p "/etc/rc2.d";
+ g#mkdir_p "/etc/rc3.d";
+ g#mkdir_p "/etc/rc5.d";
+ g#ln_sf (sprintf "%s/firstboot.sh" firstboot_dir)
+ "/etc/init.d/virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc2.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc3.d/S99virt-sysprep-firstboot";
+ g#ln_sf "/etc/init.d/virt-sysprep-firstboot"
+ "/etc/rc5.d/S99virt-sysprep-firstboot"
+
+and install_sysvinit_service g distro =
+ match distro with
+ | ("fedora"|"rhel"|"centos"|"scientificlinux"|"redhat-based") ->
+ install_sysvinit_redhat g
+ | ("opensuse"|"sles"|"suse-based") ->
+ install_sysvinit_suse g
+ | "debian" ->
+ install_sysvinit_debian g
+ | _ ->
+ failed "guest type %s is not supported" distro
+
let add_firstboot_script g root id content =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
| "linux", _ ->
- install_service g root;
+ install_service g distro;
let t = Int64.of_float (Unix.time ()) in
let r = string_random8 () in
let filename = sprintf "%s/scripts/%Ld-%s-%s" firstboot_dir t r id in
--
1.7.12
11 years
Request to relicense hash gnulib module to LGPLv2+
by Richard W.M. Jones
libguestfs (an LGPLv2+ library) uses the 'hash' module, which turns
out to be "GPL".
Actually this happened because we started to use it in a separate
GPL'd utility program, but later on included this functionality in the
core library, copying the same code from the utility but not checking
the license of 'hash'.
We'd therefore like to request that 'hash' is relicensed as LGPLv2+.
If this is not possible, we will have to rewrite the code, probably
implementing our own hash table, which would be a shame because hash
works well for our needs.
Notes:
- the code doesn't appear to call exit (it does call abort), and so
seems to be suitable for a library
- hash-pjw which we also use is already licensed as LGPLv2+
- it looks like the original author was Jim Meyering (CC'd)
- the dependencies are all LGPLv2+
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
11 years, 1 month
[PATCH 1/6] Rationalise whitespace to 4 space indentation with no trailing spaces
by Matthew Booth
RHSrvAny.c was using a mixture of 4 space indentation, and tabs with a width of
4. This commit rationalises the whitespace to use only 4 space indentation, and
removes trailing whitespace.
---
RHSrvAny/RHSrvAny.c | 537 ++++++++++++++++++++++++++--------------------------
RHSrvAny/RHSrvAny.h | 1 -
RHSrvAny/resource.h | 2 +-
3 files changed, 269 insertions(+), 271 deletions(-)
diff --git a/RHSrvAny/RHSrvAny.c b/RHSrvAny/RHSrvAny.c
index 3d4c3b4..a28f973 100644
--- a/RHSrvAny/RHSrvAny.c
+++ b/RHSrvAny/RHSrvAny.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4 -*- */
/* RHSrvAny - Turn any Windows program into a Windows service.
* Written by Yuval Kashtan.
* Copyright (C) 2010 Red Hat Inc.
@@ -42,82 +41,82 @@
#define SVCNAME TEXT("RHSrvAny")
-SERVICE_STATUS gSvcStatus;
+SERVICE_STATUS gSvcStatus;
HANDLE ghSvcStopEvent = NULL;
-SERVICE_STATUS_HANDLE gSvcStatusHandle;
+SERVICE_STATUS_HANDLE gSvcStatusHandle;
VOID SvcInstall (void);
-VOID WINAPI SvcCtrlHandler (DWORD);
-VOID WINAPI SvcMain (DWORD, LPTSTR *);
+VOID WINAPI SvcCtrlHandler (DWORD);
+VOID WINAPI SvcMain (DWORD, LPTSTR *);
VOID SvcReportEvent (LPTSTR);
-VOID SvcInit (DWORD, LPTSTR *);
+VOID SvcInit (DWORD, LPTSTR *);
VOID ReportSvcStatus (DWORD, DWORD, DWORD);
int
main (int argc, char **a_argv)
-{
+{
/* For compatibility with MinGW, see:
- http://demosten-eng.blogspot.com/2008/08/mingw-and-unicode-support.html */
+ http://demosten-eng.blogspot.com/2008/08/mingw-and-unicode-support.html */
TCHAR **argv;
- argv = CommandLineToArgvW (GetCommandLineW (), &argc);
-
- SERVICE_TABLE_ENTRY DispatchTable[] = {
- {
- SVCNAME,
- (LPSERVICE_MAIN_FUNCTION) SvcMain
- },
- { NULL, NULL }
- };
-
- if(
- lstrcmpi(
- argv[1],
- TEXT("install")
- ) == 0
- ) {
- SvcInstall();
- return EXIT_SUCCESS;
- }
-
- if (!StartServiceCtrlDispatcher( DispatchTable ))
- {
- SvcReportEvent(TEXT("StartServiceCtrlDispatcher"));
- return EXIT_FAILURE;
+ argv = CommandLineToArgvW (GetCommandLineW (), &argc);
+
+ SERVICE_TABLE_ENTRY DispatchTable[] = {
+ {
+ SVCNAME,
+ (LPSERVICE_MAIN_FUNCTION) SvcMain
+ },
+ { NULL, NULL }
+ };
+
+ if(
+ lstrcmpi(
+ argv[1],
+ TEXT("install")
+ ) == 0
+ ) {
+ SvcInstall();
+ return EXIT_SUCCESS;
}
- return EXIT_SUCCESS;
-}
+ if (!StartServiceCtrlDispatcher( DispatchTable ))
+ {
+ SvcReportEvent(TEXT("StartServiceCtrlDispatcher"));
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
+}
-VOID
+VOID
SvcInstall() {
- SC_HANDLE schSCManager;
- SC_HANDLE schService;
- TCHAR szPath[MAX_PATH];
-
- if (
- !GetModuleFileName(
- NULL,
- szPath,
- MAX_PATH
- )
- ) {
- printf("Cannot install service (%d)\n", (int) GetLastError());
- return;
- }
-
- schSCManager = OpenSCManager(
- NULL,
- NULL,
- SC_MANAGER_ALL_ACCESS
- );
-
+ SC_HANDLE schSCManager;
+ SC_HANDLE schService;
+ TCHAR szPath[MAX_PATH];
+
+ if (
+ !GetModuleFileName(
+ NULL,
+ szPath,
+ MAX_PATH
+ )
+ ) {
+ printf("Cannot install service (%d)\n", (int) GetLastError());
+ return;
+ }
+
+ schSCManager = OpenSCManager(
+ NULL,
+ NULL,
+ SC_MANAGER_ALL_ACCESS
+ );
+
if (NULL == schSCManager) {
- printf("OpenSCManager failed (%d)\n", (int) GetLastError());
- return;
+ printf("OpenSCManager failed (%d)\n", (int) GetLastError());
+ return;
}
- schService = CreateService (
+ schService = CreateService (
schSCManager,
SVCNAME,
SVCNAME,
@@ -131,212 +130,212 @@ SvcInstall() {
NULL,
NULL,
NULL
- );
-
+ );
+
if (schService == NULL) {
printf (
- "CreateService failed (%d)\n",
- (int) GetLastError()
- );
+ "CreateService failed (%d)\n",
+ (int) GetLastError()
+ );
CloseServiceHandle (schSCManager);
return;
}
- else {
- printf("Service installed successfully\n");
- }
+ else {
+ printf("Service installed successfully\n");
+ }
- CloseServiceHandle (schService);
+ CloseServiceHandle (schService);
CloseServiceHandle (schSCManager);
}
-VOID
-WINAPI
+VOID
+WINAPI
SvcMain (
- DWORD dwArgc,
- LPTSTR *lpszArgv
+ DWORD dwArgc,
+ LPTSTR *lpszArgv
) {
- gSvcStatusHandle = RegisterServiceCtrlHandler (
- SVCNAME,
- SvcCtrlHandler
- );
-
- if (!gSvcStatusHandle) {
- SvcReportEvent(TEXT("RegisterServiceCtrlHandler"));
- return;
- }
-
- gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
- gSvcStatus.dwServiceSpecificExitCode = 0;
-
- ReportSvcStatus (
- SERVICE_START_PENDING,
- NO_ERROR,
- 3000
- );
-
- SvcInit (
- dwArgc,
- lpszArgv
- );
+ gSvcStatusHandle = RegisterServiceCtrlHandler (
+ SVCNAME,
+ SvcCtrlHandler
+ );
+
+ if (!gSvcStatusHandle) {
+ SvcReportEvent(TEXT("RegisterServiceCtrlHandler"));
+ return;
+ }
+
+ gSvcStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+ gSvcStatus.dwServiceSpecificExitCode = 0;
+
+ ReportSvcStatus (
+ SERVICE_START_PENDING,
+ NO_ERROR,
+ 3000
+ );
+
+ SvcInit (
+ dwArgc,
+ lpszArgv
+ );
}
BOOL
RegistryRead (
- HKEY hHive,
- wchar_t *szKeyPath,
- wchar_t *szValue,
- wchar_t *szData,
- DWORD *nSize
+ HKEY hHive,
+ wchar_t *szKeyPath,
+ wchar_t *szValue,
+ wchar_t *szData,
+ DWORD *nSize
) {
- HKEY hKey;
- long lSuccess;
-
- lSuccess = RegOpenKey (
- hHive,
- szKeyPath,
- &hKey
- );
-
- if (lSuccess == ERROR_SUCCESS) {
- lSuccess = RegQueryValueEx (
- hKey,
- szValue,
- NULL,
- NULL,
- (LPBYTE) szData,
- nSize
- );
-
- if (lSuccess == ERROR_SUCCESS) {
- return (TRUE);
- }
- }
-
- return (FALSE);
+ HKEY hKey;
+ long lSuccess;
+
+ lSuccess = RegOpenKey (
+ hHive,
+ szKeyPath,
+ &hKey
+ );
+
+ if (lSuccess == ERROR_SUCCESS) {
+ lSuccess = RegQueryValueEx (
+ hKey,
+ szValue,
+ NULL,
+ NULL,
+ (LPBYTE) szData,
+ nSize
+ );
+
+ if (lSuccess == ERROR_SUCCESS) {
+ return (TRUE);
+ }
+ }
+
+ return (FALSE);
}
-VOID
+VOID
SvcInit (
- DWORD dwArgc,
- LPTSTR *lpszArgv
+ DWORD dwArgc,
+ LPTSTR *lpszArgv
) {
- DWORD nSize;
- BOOL fSuccess;
+ DWORD nSize;
+ BOOL fSuccess;
STARTUPINFO si;
- wchar_t szPWD[1024];
+ wchar_t szPWD[1024];
PROCESS_INFORMATION pi;
- wchar_t szCmdLine[1024];
- wchar_t szRegistryPath[1024];
+ wchar_t szCmdLine[1024];
+ wchar_t szRegistryPath[1024];
- // TO_DO: Declare and set any required variables.
- // Be sure to periodically call ReportSvcStatus() with
+ // TO_DO: Declare and set any required variables.
+ // Be sure to periodically call ReportSvcStatus() with
// SERVICE_START_PENDING. If initialization fails, call
// ReportSvcStatus with SERVICE_STOPPED.
// Create an event. The control handler function, SvcCtrlHandler,
// signals this event when it receives the stop control code.
- ghSvcStopEvent = CreateEvent (
- NULL,
- TRUE,
- FALSE,
- NULL
- );
+ ghSvcStopEvent = CreateEvent (
+ NULL,
+ TRUE,
+ FALSE,
+ NULL
+ );
if (ghSvcStopEvent == NULL) {
ReportSvcStatus (
- SERVICE_STOPPED,
- NO_ERROR,
- 0
- );
+ SERVICE_STOPPED,
+ NO_ERROR,
+ 0
+ );
return;
}
// Report running status when initialization is complete.
ReportSvcStatus (
- SERVICE_RUNNING,
- NO_ERROR,
- 0
- );
+ SERVICE_RUNNING,
+ NO_ERROR,
+ 0
+ );
// TO_DO: Perform work until service stops.
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
- nSize=1024;
+ nSize=1024;
#ifdef HAVE_SWPRINTF_S
- swprintf_s (
- szRegistryPath,
- nSize,
+ swprintf_s (
+ szRegistryPath,
+ nSize,
#else
- snwprintf (
- szRegistryPath,
- sizeof szRegistryPath,
+ snwprintf (
+ szRegistryPath,
+ sizeof szRegistryPath,
#endif
- L"SYSTEM\\CurrentControlSet\\services\\%s\\Parameters",
- SVCNAME
- );
-
- fSuccess = RegistryRead (
- HKEY_LOCAL_MACHINE,
- szRegistryPath,
- L"CommandLine",
- szCmdLine,
- &nSize
- );
-
- if (fSuccess) {
- fSuccess = RegistryRead (
- HKEY_LOCAL_MACHINE,
- szRegistryPath,
- L"PWD",
- szPWD,
- &nSize
- );
- }
-
- if (fSuccess) {
- fSuccess = CreateProcess (
- NULL,
- szCmdLine,
- NULL,
- NULL,
- FALSE,
- (
- CREATE_NO_WINDOW
- ),
- NULL,
- szPWD,
- &si,
- &pi
- );
- }
-
- // treat errors
+ L"SYSTEM\\CurrentControlSet\\services\\%s\\Parameters",
+ SVCNAME
+ );
+
+ fSuccess = RegistryRead (
+ HKEY_LOCAL_MACHINE,
+ szRegistryPath,
+ L"CommandLine",
+ szCmdLine,
+ &nSize
+ );
+
+ if (fSuccess) {
+ fSuccess = RegistryRead (
+ HKEY_LOCAL_MACHINE,
+ szRegistryPath,
+ L"PWD",
+ szPWD,
+ &nSize
+ );
+ }
+
+ if (fSuccess) {
+ fSuccess = CreateProcess (
+ NULL,
+ szCmdLine,
+ NULL,
+ NULL,
+ FALSE,
+ (
+ CREATE_NO_WINDOW
+ ),
+ NULL,
+ szPWD,
+ &si,
+ &pi
+ );
+ }
+
+ // treat errors
while(1)
{
// Check whether to stop the service.
WaitForSingleObject (
- ghSvcStopEvent,
- INFINITE
- );
+ ghSvcStopEvent,
+ INFINITE
+ );
ReportSvcStatus (
- SERVICE_STOPPED,
- NO_ERROR,
- 0
- );
+ SERVICE_STOPPED,
+ NO_ERROR,
+ 0
+ );
return;
}
}
VOID ReportSvcStatus (
- DWORD dwCurrentState,
- DWORD dwWin32ExitCode,
- DWORD dwWaitHint
+ DWORD dwCurrentState,
+ DWORD dwWin32ExitCode,
+ DWORD dwWaitHint
) {
static DWORD dwCheckPoint = 1;
@@ -345,99 +344,99 @@ VOID ReportSvcStatus (
gSvcStatus.dwWin32ExitCode = dwWin32ExitCode;
gSvcStatus.dwWaitHint = dwWaitHint;
- if (dwCurrentState == SERVICE_START_PENDING) {
- gSvcStatus.dwControlsAccepted = 0;
- }
- else {
- gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
- }
-
- if (
- (dwCurrentState == SERVICE_RUNNING) ||
- (dwCurrentState == SERVICE_STOPPED)
- ) {
- gSvcStatus.dwCheckPoint = 0;
- } else {
- gSvcStatus.dwCheckPoint = dwCheckPoint++;
- }
-
- // Report the status of the service to the SCM.
- SetServiceStatus (
- gSvcStatusHandle,
- &gSvcStatus
- );
+ if (dwCurrentState == SERVICE_START_PENDING) {
+ gSvcStatus.dwControlsAccepted = 0;
+ }
+ else {
+ gSvcStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
+ }
+
+ if (
+ (dwCurrentState == SERVICE_RUNNING) ||
+ (dwCurrentState == SERVICE_STOPPED)
+ ) {
+ gSvcStatus.dwCheckPoint = 0;
+ } else {
+ gSvcStatus.dwCheckPoint = dwCheckPoint++;
+ }
+
+ // Report the status of the service to the SCM.
+ SetServiceStatus (
+ gSvcStatusHandle,
+ &gSvcStatus
+ );
}
-VOID
-WINAPI
+VOID
+WINAPI
SvcCtrlHandler (
- DWORD dwCtrl
+ DWORD dwCtrl
) {
- switch(dwCtrl) {
- case SERVICE_CONTROL_STOP:
+ switch(dwCtrl) {
+ case SERVICE_CONTROL_STOP:
ReportSvcStatus(SERVICE_STOP_PENDING, NO_ERROR, 0);
/* Signal the service to stop. */
SetEvent(ghSvcStopEvent);
-
+
return;
-
- case SERVICE_CONTROL_INTERROGATE:
+
+ case SERVICE_CONTROL_INTERROGATE:
/* Fall through to send current status. */
- break;
-
- default:
break;
- }
+
+ default:
+ break;
+ }
ReportSvcStatus(gSvcStatus.dwCurrentState, NO_ERROR, 0);
}
/* Logs messages to the event log */
-VOID
+VOID
SvcReportEvent (
- LPTSTR szFunction
-) {
+ LPTSTR szFunction
+) {
TCHAR Buffer[80];
HANDLE hEventSource;
LPCTSTR lpszStrings[2];
hEventSource = RegisterEventSource (
- NULL,
- SVCNAME
- );
+ NULL,
+ SVCNAME
+ );
if (
- NULL != hEventSource
- ) {
+ NULL != hEventSource
+ ) {
#ifdef HAVE_STRINGCCHPRINTF
- StringCchPrintf
+ StringCchPrintf
#else
- snwprintf
+ snwprintf
#endif
- (
- Buffer,
- 80,
- TEXT("%s failed with %d"),
- szFunction,
- GetLastError()
- );
+ (
+ Buffer,
+ 80,
+ TEXT("%s failed with %d"),
+ szFunction,
+ GetLastError()
+ );
lpszStrings[0] = SVCNAME;
lpszStrings[1] = Buffer;
- ReportEvent (
- hEventSource,
- EVENTLOG_ERROR_TYPE,
- 0,
- SVC_ERROR,
- NULL,
- 2,
- 0,
- lpszStrings,
- NULL
- );
-
- DeregisterEventSource (hEventSource);
+ ReportEvent (
+ hEventSource,
+ EVENTLOG_ERROR_TYPE,
+ 0,
+ SVC_ERROR,
+ NULL,
+ 2,
+ 0,
+ lpszStrings,
+ NULL
+ );
+
+ DeregisterEventSource (hEventSource);
}
}
diff --git a/RHSrvAny/RHSrvAny.h b/RHSrvAny/RHSrvAny.h
index 72ada2a..f439056 100644
--- a/RHSrvAny/RHSrvAny.h
+++ b/RHSrvAny/RHSrvAny.h
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4 -*- */
/* RHSrvAny - Turn any Windows program into a Windows service.
* Written by Yuval Kashtan.
* Copyright (C) 2010 Red Hat Inc.
diff --git a/RHSrvAny/resource.h b/RHSrvAny/resource.h
index ad31821..14bba9b 100644
--- a/RHSrvAny/resource.h
+++ b/RHSrvAny/resource.h
@@ -4,7 +4,7 @@
//
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
--
1.8.3.1
11 years, 4 months
Recent changes in supermin/libguestfs that may affect packagers
by Richard W.M. Jones
All in libguestfs >= 1.23.19.
- The location of the javadoc has moved from:
/usr/share/javadoc/libguestfs-java-$version to:
/usr/share/javadoc/libguestfs.
- Compressed cpio images are used, if possible. You will see two *.gz
files appearing in appliance/supermin.d during the build and copied to
/usr/lib/guestfs/supermin.d:
$ ls -lh appliance/supermin.d/
total 1.3M
-rw-rw-r--. 1 rjones rjones 324K Aug 28 22:45 base.img.gz
-rw-rw-r--. 1 rjones rjones 744K Aug 28 22:47 daemon.img.gz
-rw-rw-r--. 1 rjones rjones 170K Aug 28 22:45 hostfiles
-rw-rw-r--. 1 rjones rjones 5.0K Aug 28 22:40 init.img
-rw-rw-r--. 1 rjones rjones 2.0K Aug 28 22:40 udev-rules.img
This saves a considerable amount of space (~5.9 MB -> ~1.3 MB).
Compressed cpio images requires supermin >= 4.1.4. Earlier versions
of supermin will continue to work. Note that you must not build
libguestfs with supermin >= 4.1.4 and then try to use libguestfs with
supermin-helper < 4.1.4. That won't work.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
11 years, 4 months
relicense module spawn-pipe
by Or Goshen
hi,
I would like to use the module spawn-pipe in a library called libguestfs to
make it compileable under mingw. currently the library is using the
fork/exec combination which doesnt compile under mingw (mingw doesnt
support fork). spawn-pipe looks like a good replacement, however it is
licensed GPL which is a problem for an LGPL library.
Is it possible to relicense that module (and its dependencies) to be LGPL
instead ?
Thanks,
Or
11 years, 4 months
modules in gnulib that are GPL
by Or Goshen
gettime
hash
human
memcpy
openat-die
openat-safer
quote
quotearg
readlinkat
save-cwd
symlinkat
timespec
utimens
xstrtol
xstrtoll
xstrtoumax
xvasprintf
I didnt track where they are uses, some of them arent used directly.
11 years, 4 months
[PATCH 00/67] Proposed patches for libguestfs 1.22.6.
by Richard W.M. Jones
In the kernel and qemu communities it is routine for patches that will
be backported to stable branches to be posted for review. I'm
proposing we do the same for libguestfs stable branches.
All of the attached have been tested with 'make check-release'.
Rich.
11 years, 4 months