mailing list of musl libc
 help / color / mirror / code / Atom feed
efb3f0cbf18b5e3ccc451dcf4027314f3a1893a5 blob 1098 bytes (raw)

 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
35
36
37
38
39
40
41
42
43
 
#include "pthread_impl.h"

static struct pthread *main_thread = &(struct pthread){0};

static void *__pthread_tsd_main[PTHREAD_KEYS_MAX] = { 0 };
/* unused? */
const size_t __pthread_tsd_size = sizeof(__pthread_tsd_main);

static int init_main_thread()
{
	__syscall(SYS_rt_sigprocmask, SIG_UNBLOCK,
		SIGPT_SET, 0, __SYSCALL_SSLEN);
	if (__set_thread_area(TP_ADJ(main_thread)) < 0) return -1;
	main_thread->canceldisable = libc.canceldisable;
	main_thread->tsd = __pthread_tsd_main;
	main_thread->errno_ptr = __errno_location();
	main_thread->self = main_thread;
	main_thread->tid = main_thread->pid =
		__syscall(SYS_set_tid_address, &main_thread->tid);
	libc.main_thread = main_thread;
	return 0;
}

pthread_t __pthread_self_def()
{
	static int init, failed;
	if (!init) {
		if (failed) return 0;
		if (init_main_thread() < 0) failed = 1;
		if (failed) return 0;
		init = 1;
	}
	return __pthread_self();
}

weak_alias(__pthread_self_def, pthread_self);
weak_alias(__pthread_self_def, __pthread_self_init);

void *__install_initial_tls(void *p)
{
	main_thread = p;
	return __pthread_self_def();
}
debug log:

solving efb3f0c ...
found efb3f0c in https://inbox.vuxu.org/musl/1360574285.9132.14.camel@eris.loria.fr/
found 23dbaa5 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 23dbaa5eb805ccbcf65d9e1772b9ab6cabb52853	src/thread/pthread_self.c

applying [1/1] https://inbox.vuxu.org/musl/1360574285.9132.14.camel@eris.loria.fr/
diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c
index 23dbaa5..efb3f0c 100644

Checking patch src/thread/pthread_self.c...
Applied patch src/thread/pthread_self.c cleanly.

index at:
100644 efb3f0cbf18b5e3ccc451dcf4027314f3a1893a5	src/thread/pthread_self.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).