GCC Code Coverage Report


Directory: src/gate/
File: src/gate/system/services.c
Date: 2026-02-03 22:06:38
Exec Total Coverage
Lines: 3 10 30.0%
Functions: 1 1 100.0%
Branches: 1 7 14.3%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright(c) 2018-2026, Stefan Meislinger |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 #include "gate/system/services.h"
30 #include "gate/debugging.h"
31
32
33 #if defined(GATE_SYS_WIN)
34 # if defined(GATE_SYS_WINSTORE) || defined(GATE_SYS_WIN16)
35 # define GATE_SYSTEM_SERVICES_NO_IMPL
36 # else
37 /* not handled here, see services_win.c */
38 # endif
39 #elif defined(GATE_SYS_POSIX)
40 /* not handled here, see services_posix.c */
41 #elif defined(GATE_SYS_EFI)
42 # define GATE_SYSTEM_SERVICES_NO_IMPL
43 #elif defined(GATE_SYS_DOS)
44 # define GATE_SYSTEM_SERVICES_NO_IMPL
45 #else
46 # define GATE_SYSTEM_SERVICES_NO_IMPL
47 #endif
48
49
50
51 /* generic implementation: */
52 1 char const* gate_service_print_state(gate_enumint_t state)
53 {
54
1/7
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
1 switch (state)
55 {
56 case GATE_SERVICE_STATE_STOPPED: return "Stopped";
57 1 case GATE_SERVICE_STATE_RUNNING: return "Running";
58 case GATE_SERVICE_STATE_ERROR: return "Error";
59 case GATE_SERVICE_STATE_PAUSED: return "Paused";
60 case GATE_SERVICE_STATE_STARTING: return "Starting";
61 case GATE_SERVICE_STATE_STOPPING: return "Stopping";
62 default:
63 case GATE_SERVICE_STATE_UNKNOWN: return "Unknown";
64 }
65 }
66
67
68
69 #if defined(GATE_SYSTEM_SERVICES_NO_IMPL)
70
71 gate_result_t gate_services_enum(gate_service_enum_callback_t callback, void* user_param)
72 {
73 (void)callback;
74 (void)user_param;
75 return GATE_RESULT_NOTIMPLEMENTED;
76 }
77
78 gate_result_t gate_service_start(gate_string_t const* name, gate_service_message_callback_t msg_callback, void* user_param)
79 {
80 (void)name;
81 (void)msg_callback;
82 (void)user_param;
83 return GATE_RESULT_NOTIMPLEMENTED;
84 }
85
86 gate_result_t gate_service_stop(gate_string_t const* name, gate_uint32_t wait_timeout, gate_bool_t force,
87 gate_service_message_callback_t msg_callback, void* user_param)
88 {
89 (void)name;
90 (void)wait_timeout;
91 (void)force;
92 (void)msg_callback;
93 (void)user_param;
94 return GATE_RESULT_NOTIMPLEMENTED;
95 }
96
97 gate_result_t gate_service_get_config(gate_string_t const* name, gate_service_config_t* config)
98 {
99 (void)name;
100 (void)config;
101 return GATE_RESULT_NOTIMPLEMENTED;
102 }
103
104 gate_result_t gate_service_get_status(gate_string_t const* name, gate_enumint_t* state, gate_string_t* process_id)
105 {
106 (void)name;
107 (void)state;
108 (void)process_id;
109 return GATE_RESULT_NOTIMPLEMENTED;
110 }
111
112 gate_result_t gate_service_register(gate_string_t const* name, gate_string_t const* command, gate_string_t const* descr,
113 gate_uint32_t flags, gate_string_t const* dependencies,
114 gate_service_message_callback_t msg_callback, void* user_param)
115 {
116 (void)name;
117 (void)command;
118 (void)descr;
119 (void)flags;
120 (void)dependencies;
121 (void)msg_callback;
122 (void)user_param;
123 return GATE_RESULT_NOTIMPLEMENTED;
124 }
125
126 gate_result_t gate_service_unregister(gate_string_t const* name,
127 gate_service_message_callback_t msg_callback, void* user_param)
128 {
129 (void)name;
130 (void)msg_callback;
131 (void)user_param;
132 return GATE_RESULT_NOTIMPLEMENTED;
133 }
134
135
136 #endif /* GATE_SYSTEM_SERVICES_NO_IMPL */
137