You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/11/04 16:00:51 UTC

[commons-daemon] branch master updated (4999982 -> c55467d)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git.


    from 4999982  Add spotbugs-maven-plugin.
     new 5b4320b  reportServiceStatusE() shows scale of dwWaitHint as millisecond in logging.
     new c55467d  reportServiceStatusE() shows a short description for dwCurrentState.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                   |  6 ++++++
 src/native/windows/apps/prunsrv/prunsrv.c | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

[commons-daemon] 01/02: reportServiceStatusE() shows scale of dwWaitHint as millisecond in logging.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git

commit 5b4320be2dcc8b9cf3c932d29c5a7fbaef7202c3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 4 11:59:54 2021 -0400

    reportServiceStatusE() shows scale of dwWaitHint as millisecond in
    logging.
---
 src/native/windows/apps/prunsrv/prunsrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c
index 86fb9a0..ee08eef 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -1053,7 +1053,7 @@ static BOOL reportServiceStatusE(DWORD dwCurrentState,
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;
 
-   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatusE: dwCurrentState = %d, dwWin32ExitCode = %d, dwWaitHint = %d, dwServiceSpecificExitCode = %d.",
+   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatusE: dwCurrentState = %d, dwWin32ExitCode = %d, dwWaitHint = %d milliseconds, dwServiceSpecificExitCode = %d.",
                dwCurrentState, dwWin32ExitCode, dwWaitHint, dwServiceSpecificExitCode);
 
    if (_service_mode && _service_status_handle) {

[commons-daemon] 02/02: reportServiceStatusE() shows a short description for dwCurrentState.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git

commit c55467dcd9eaf7782393633c8c9cd633780e1a33
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 4 12:00:48 2021 -0400

    reportServiceStatusE() shows a short description for dwCurrentState.
---
 src/changes/changes.xml                   |  6 ++++++
 src/native/windows/apps/prunsrv/prunsrv.c | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 627a5ca..751e073 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -55,6 +55,12 @@
       <action type="add" dev="ggregory" due-to="John Patrick">
         Enable Dependabot #20.
       </action>
+      <action type="add" dev="ggregory" due-to="Gary Gregory">
+        reportServiceStatusE() shows scale of dwWaitHint as millisecond in logging.
+      </action>
+      <action type="add" dev="ggregory" due-to="Gary Gregory">
+        reportServiceStatusE() shows a short description for dwCurrentState.
+      </action>
       <!-- -UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">
         Bump actions/cache from v2 to v2.1.6 #24, #30.
diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c
index ee08eef..ac9ff8a 100644
--- a/src/native/windows/apps/prunsrv/prunsrv.c
+++ b/src/native/windows/apps/prunsrv/prunsrv.c
@@ -1031,6 +1031,17 @@ static BOOL docmdUpdateService(LPAPXCMDLINE lpCmdline)
     return rv;
 }
 
+/** Maps dwCurrentState to the constant name described on https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_status */
+static const char* gSzCurrentState[] = {
+    "",
+    "SERVICE_STOPPED",
+    "SERVICE_START_PENDING",
+    "SERVICE_STOP_PENDING",
+    "SERVICE_RUNNING",
+    "SERVICE_CONTINUE_PENDING",
+    "SERVICE_PAUSE_PENDING",
+    "SERVICE_PAUSED"
+};
 
 /* Report the service status to the SCM, including service specific exit code.
  *
@@ -1053,8 +1064,9 @@ static BOOL reportServiceStatusE(DWORD dwCurrentState,
    static DWORD dwCheckPoint = 1;
    BOOL fResult = TRUE;
 
-   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatusE: dwCurrentState = %d, dwWin32ExitCode = %d, dwWaitHint = %d milliseconds, dwServiceSpecificExitCode = %d.",
-               dwCurrentState, dwWin32ExitCode, dwWaitHint, dwServiceSpecificExitCode);
+   int gSzCurrentStateIdx = dwCurrentState < 0 ? 0 : dwCurrentState > _countof(gSzCurrentState) ? 0 : dwCurrentState;
+   apxLogWrite(APXLOG_MARK_DEBUG "reportServiceStatusE: dwCurrentState = %d (%s), dwWin32ExitCode = %d, dwWaitHint = %d milliseconds, dwServiceSpecificExitCode = %d.",
+               dwCurrentState, gSzCurrentState[gSzCurrentStateIdx], dwWin32ExitCode, dwWaitHint, dwServiceSpecificExitCode);
 
    if (_service_mode && _service_status_handle) {
        if (dwCurrentState == SERVICE_RUNNING)