blob: d36b2cc11993868abc993089534a5f1aad32dc70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2026 The FreeBSD Foundation
*
* This software were developed by
* Konstantin Belousov <kib@FreeBSD.org> under sponsorship from
* the FreeBSD Foundation.
*/
#include <sys/types.h>
#include <sys/procdesc.h>
#include <errno.h>
#include <unistd.h>
pid_t
pdrfork_thread(int *fdp, int pdflags, int rfflags, void *stack_addr,
int (*start_fn)(void *), void *arg)
{
pid_t res;
int ret;
/* See comment in rfork_thread_gen.c. */
if (stack_addr != NULL) {
errno = EOPNOTSUPP;
return (-1);
}
res = pdrfork(fdp, pdflags, rfflags);
if (res == 0) {
ret = start_fn(arg);
_exit(ret);
}
return (res);
}
|