| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include_next <spawn.h> /* IWYU pragma: export */ |
| 5 |
|
| 6 |
/* pidfd_spawn() and posix_spawnattr_setcgroup_np() were added in glibc 2.39. Redirect to shims that |
| 7 |
* return ENOSYS at runtime when the libc symbols aren't available, so callers don't need to worry |
| 8 |
* about the libc version. */ |
| 9 |
int pidfd_spawn_shim(pid_t *restrict pidfd, const char *restrict path, |
| 10 |
const posix_spawn_file_actions_t *restrict file_actions, |
| 11 |
const posix_spawnattr_t *restrict attrp, |
| 12 |
char *const argv[restrict], char *const envp[restrict]); |
| 13 |
#define pidfd_spawn pidfd_spawn_shim |
| 14 |
|
| 15 |
int posix_spawnattr_setcgroup_np_shim(posix_spawnattr_t *attr, int cgroup); |
| 16 |
#define posix_spawnattr_setcgroup_np posix_spawnattr_setcgroup_np_shim |
| 17 |
|
| 18 |
/* Defined in <spawn.h> since glibc 2.39. */ |
| 19 |
#ifndef POSIX_SPAWN_SETCGROUP |
| 20 |
# define POSIX_SPAWN_SETCGROUP 0x100 |
| 21 |
#endif |