Re: FreeBSD Port: www/firefox

Jan Beich <[email protected]>
Newsgroups gmane.os.freebsd.devel.gecko,gmane.os.freebsd.devel.threading
Message-ID <[email protected]>
Konstantin Belousov <[email protected]> writes:

> On Wed, Apr 12, 2017 at 02:00:31AM +0200, Jan Beich wrote:
>
>> Christoph Moench-Tegeder <[email protected]> writes:
>> 
>> > ## Jan Beich ([email protected]):
>> >
>> >> Walter Schwarzenfeld (privately) writes:
>> >> > With gtk3 on it starts after sysctl p1003_1b.sem_nsems_max=512.
>> >> > Please => pkg-message.
>> >> 
>> >> Don't use sem(4), it's deprecated since FreeBSD 9.0. p1003_1b.sem_nsems_max
>> >> doesn't have an effect with the new implementation.
>> >> 
>> >> https://svnweb.freebsd.org/changeset/base/201546
>> >
>> > Um. Firefox' "configure" code explicitly checks the maximum number
>> > of semaphores via sysconf(_SC_SEM_NSEMS_MAX) (that's in
>> > python/futures/concurrent/futures/process.py l. 250). As far as I
>> > can tell, in FreeBSD 10.3 that value is set by sysctl
>> > p1003_1b.sem_nsems_max - so at least for the "old" FreeBSD, that
>> > would be the way to go? (and it worked for me).
>> 
>> FreeBSD 8.x has been EOL since 2015-08-01. However, sysconf() ends up
>> using sem(4) even for new code. Maybe someone from threads@ knows more.
>> 
>> $ getconf SEM_NSEMS_MAX
>> undefined
>> 
>> $ kldload sem
>> $ getconf SEM_NSEMS_MAX
>> 30
>
> The following should fix sysconf(3):
>
> diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
> index ffd9f6b4fa7..a69f3778b64 100644
> --- a/lib/libc/gen/sysconf.c
> +++ b/lib/libc/gen/sysconf.c
> @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
>  #include <limits.h>
>  #include <paths.h>
>  #include <pthread.h>		/* we just need the limits */
> +#include <semaphore.h>
>  #include <time.h>
>  #include <unistd.h>
>  #include "un-namespace.h"
> @@ -299,13 +300,9 @@ do_NAME_MAX:
>  		mib[1] = CTL_P1003_1B_RTSIG_MAX;
>  		goto yesno;
>  	case _SC_SEM_NSEMS_MAX:
> -		mib[0] = CTL_P1003_1B;
> -		mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX;
> -		goto yesno;
> +		return (-1);
>  	case _SC_SEM_VALUE_MAX:
> -		mib[0] = CTL_P1003_1B;
> -		mib[1] = CTL_P1003_1B_SEM_VALUE_MAX;
> -		goto yesno;
> +		return (SEM_VALUE_MAX);
>  	case _SC_SIGQUEUE_MAX:
>  		mib[0] = CTL_P1003_1B;
>  		mib[1] = CTL_P1003_1B_SIGQUEUE_MAX;

I confirm, the patch fixes Firefox 53+ build with sem(4) loaded.
signature.asc (application/pgp-signature, 584 B)
-----BEGIN PGP SIGNATURE-----

iQF8BAEBCgBmBQJY7nuIXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREQjQ0MzY3NEM3RDIzNTc4NkUxNDkyQ0VF
NEM3Nzg4MzQ3OURCRERCAAoJEOTHeINHnb3b6VQH/1N1+GzRuT236h304Gmjmttf
K46wLTKqkNGiQhmHjUipa04Mqgn7tRC9JxisG70WcP2rbx7Q94J02BZqm9opx7zE
gCoT7xKMVpjAxic3ZVOrWeTFQGZVMgwCMYoAPtUfv32RURbUFvLKqX16PihTdHf3
magHE6/m3A5hOFxTbK4MGLT8oXGGSacXqcUacjwtEnb5Nk63j4EnkcpW0KHfYLEi
PKNXPHid/Fi6ISFPj9gRmzDgWwLV/+sm1n6UuRehxhKLxBT06fT6xFWzXEQrUhle
qdGq6lzT+Qk26T+02UTvSVd7mMLSJoa7TpYusI7QfbNgtL/vtfSRNE9pUbmN+Lo=
=PmDL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.