Monado OpenXR Runtime
Loading...
Searching...
No Matches
u_process.h
Go to the documentation of this file.
1// Copyright 2020, Collabora, Ltd.
2// Copyright 2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Simple process handling
7 * @author Christoph Haag <christoph.haag@collabora.com>
8 * @ingroup aux_util
9 */
10
11#pragma once
12
13#include <stdio.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct u_process;
20
21/*!
22 * Creates a handle for this process that is unique to the operating system user and @p pid_filename. Returns NULL if
23 * another process holding the same pidfile is already running.
24 *
25 * @todo If built without libbsd support, a placeholder value is returned that needs to be handled by the caller.
26 *
27 * @param pid_filename Name of the pidfile in the runtime dir, processes using the same name exclude each other.
28 * Ignored when built without libbsd, must not be NULL otherwise.
29 * @return a new u_process handle, or NULL if another process holds the pidfile or the pidfile can't be created.
30 * @ingroup aux_util
31 */
32struct u_process *
33u_process_create_if_not_running(const char *pid_filename);
34
35/*!
36 * Releases the unique handle of the operating system user.
37 *
38 * @ingroup aux_util
39 */
40void
41u_process_destroy(struct u_process *proc);
42
43#ifdef __cplusplus
44}
45#endif
void u_process_destroy(struct u_process *proc)
Releases the unique handle of the operating system user.
Definition u_process.c:95
struct u_process * u_process_create_if_not_running(const char *pid_filename)
Creates a handle for this process that is unique to the operating system user and pid_filename.
Definition u_process.c:52
Definition u_process.c:43