raise() implementation in freebsd libc vs musl libc

Andrew Kelley andrew at ziglang.org
Thu Dec 13 05:11:37 UTC 2018


Howdy,

I noticed that musl-libc blocks signals in raise() to prevent a race
condition, but freebsd libc does not. is there a reason it's necessary
on linux and not freebsd?

musl
int raise(int sig)
{
	sigset_t set;
	__block_app_sigs(&set);
	int ret = syscall(SYS_tkill, __pthread_self()->tid, sig);
	__restore_sigs(&set);
	return ret;
}

freebsd
int
__raise(int s)
{
	long id;

	if (__sys_thr_self(&id) == -1)
		return (-1);
	return (__sys_thr_kill(id, s));
}

Regards,
Andrew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20181213/21252c8a/attachment.sig>


More information about the freebsd-hackers mailing list