aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/ffork-Linux.c
blob: 5dbd75cf048a4c40531e815c4a0551ae5c5fb17b (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
#define ffork ffork_clone
#define getfforkid getfforkid_clone
#include "ffork-Linux-clone.c"
#undef ffork
#undef getfforkid

#define ffork ffork_pthread
#define getfforkid getfforkid_pthread
#include "ffork-pthread.c"
#undef ffork
#undef getfforkid

extern int _islinuxnptl(void);

int
ffork(int flags, void (*fn)(void*), void *arg)
{
	if(_islinuxnptl())
		return ffork_pthread(flags, fn, arg);
	else
		return ffork_clone(flags, fn, arg);
}

int
getfforkid(void)
{
	if(_islinuxnptl())
		return getfforkid_pthread();
	else
		return getfforkid_clone();
}