LLDB mainline
PosixSpawnResponsible.h
Go to the documentation of this file.
1//===-- PosixSpawnResponsible.h ---------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_HOST_POSIXSPAWNRESPONSIBLE_H
10#define LLDB_HOST_POSIXSPAWNRESPONSIBLE_H
11
12#include <spawn.h>
13
14#include <dispatch/dispatch.h>
15#include <dlfcn.h>
16
17errno_t responsibility_spawnattrs_setdisclaim(posix_spawnattr_t *attrs,
18 bool disclaim);
19
20static inline int setup_posix_spawn_responsible_flag(posix_spawnattr_t *attr) {
22 *responsibility_spawnattrs_setdisclaim_ptr;
23 static dispatch_once_t pred;
24 dispatch_once(&pred, ^{
25 responsibility_spawnattrs_setdisclaim_ptr =
26 reinterpret_cast<__typeof__(&responsibility_spawnattrs_setdisclaim)>(
27 dlsym(RTLD_DEFAULT, "responsibility_spawnattrs_setdisclaim"));
28 });
29 if (responsibility_spawnattrs_setdisclaim_ptr)
30 return responsibility_spawnattrs_setdisclaim_ptr(attr, true);
31 return 0;
32}
33
34#endif // LLDB_HOST_POSIXSPAWNRESPONSIBLE_H
static int setup_posix_spawn_responsible_flag(posix_spawnattr_t *attr)
errno_t responsibility_spawnattrs_setdisclaim(posix_spawnattr_t *attrs, bool disclaim)