|
wlmaker
|
#include <libbase/libbase.h>#include <stdbool.h>

Go to the source code of this file.
Typedefs | |
| typedef struct _wlm_util_subprocess_monitor_t | wlm_util_subprocess_monitor_t |
| typedef void(* | wlm_util_subprocess_terminated_callback_t) (void *userdata_ptr, struct wlm_util_subprocess *subprocess_handle_ptr, int state, int code) |
Functions | |
| wlm_util_subprocess_monitor_t * | wlm_util_subprocess_monitor_create (struct wl_event_loop *wl_event_loop_ptr) |
| void | wlm_util_subprocess_monitor_destroy (wlm_util_subprocess_monitor_t *monitor_ptr) |
| struct wlm_util_subprocess * | wlm_util_subprocess_monitor_entrust (wlm_util_subprocess_monitor_t *monitor_ptr, bs_subprocess_t *subprocess_ptr, wlm_util_subprocess_terminated_callback_t terminated_callback, void *userdata_ptr, bs_dynbuf_t *stdout_dynbuf_ptr) |
| void | wlm_util_subprocess_monitor_cede (wlm_util_subprocess_monitor_t *monitor_ptr, struct wlm_util_subprocess *subprocess_handle_ptr) |
| bool | wlm_util_subprocess_monitor_run (wlm_util_subprocess_monitor_t *monitor_ptr, bs_subprocess_t *subprocess_ptr) |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| typedef struct _wlm_util_subprocess_monitor_t wlm_util_subprocess_monitor_t |
Forward definition for the subprocess monitor.
| typedef void(* wlm_util_subprocess_terminated_callback_t) (void *userdata_ptr, struct wlm_util_subprocess *subprocess_handle_ptr, int state, int code) |
Callback for then the subprocess is terminated.
| userdata_ptr | |
| subprocess_handle_ptr | |
| state | |
| code |
| void wlm_util_subprocess_monitor_cede | ( | wlm_util_subprocess_monitor_t * | monitor_ptr, |
| struct wlm_util_subprocess * | subprocess_handle_ptr | ||
| ) |
Releases the reference held on subprocess_handle_ptr. Once the subprocess terminates, all corresponding resources will be freed.
| monitor_ptr | |
| subprocess_handle_ptr |
| wlm_util_subprocess_monitor_t * wlm_util_subprocess_monitor_create | ( | struct wl_event_loop * | wl_event_loop_ptr | ) |
Creates the subprocess monitor.
The subprocess monitor keeps references to all entrusted subprocesses, reads their output with appropriate logging, and issues a callback if and when the subprocess is terminated.
| wl_event_loop_ptr |
| void wlm_util_subprocess_monitor_destroy | ( | wlm_util_subprocess_monitor_t * | monitor_ptr | ) |
Destroys the subprocess monitor.
| monitor_ptr |
| struct wlm_util_subprocess * wlm_util_subprocess_monitor_entrust | ( | wlm_util_subprocess_monitor_t * | monitor_ptr, |
| bs_subprocess_t * | subprocess_ptr, | ||
| wlm_util_subprocess_terminated_callback_t | terminated_callback, | ||
| void * | userdata_ptr, | ||
| bs_dynbuf_t * | stdout_dynbuf_ptr | ||
| ) |
Passes ownership of the started subprocess_ptr to monitor_ptr.
Also registers a set of callbacks that will be triggered. Permits to keep a central register of all started sub-processes, to monitor for termination, and to link up connecting clients with the sub-processes.
| monitor_ptr | |
| subprocess_ptr | |
| terminated_callback | |
| userdata_ptr | |
| stdout_dynbuf_ptr |
| bool wlm_util_subprocess_monitor_run | ( | wlm_util_subprocess_monitor_t * | monitor_ptr, |
| bs_subprocess_t * | subprocess_ptr | ||
| ) |
Starts, entrust and cedes a subprocess to the monitor.
A convenience wrapper for bs_subprocess_start, wlm_util_subprocess_monitor_entrust and wlm_util_subprocess_monitor_cede.
| monitor_ptr | |
| subprocess_ptr | Subprocess. Ignored, if NULL. Takes ownership. |