[x264-devel] [PATCH] Make use of _SC_NPROCESSORS_ONLN on OpenBSD
BugMaster
BugMaster at narod.ru
Mon Apr 12 19:21:40 UTC 2021
On Sat, 3 Apr 2021 16:53:21 -0400, Brad Smith wrote:
> Make use of _SC_NPROCESSORS_ONLN on OpenBSD.
> Modern versions of OpenBSD the online number vs configured
> can be different.
> diff --git a/common/cpu.c b/common/cpu.c
> index 96585aa8..46e9b514 100644
> --- a/common/cpu.c
> +++ b/common/cpu.c
> @@ -433,7 +433,7 @@ int x264_cpu_num_processors( void )
> #elif SYS_WINDOWS
> return x264_pthread_num_processors_np();
>
> -#elif SYS_CYGWIN || SYS_SunOS
> +#elif SYS_CYGWIN || SYS_SunOS || SYS_OPENBSD
> return sysconf( _SC_NPROCESSORS_ONLN );
>
> #elif SYS_LINUX
> @@ -460,15 +460,10 @@ int x264_cpu_num_processors( void )
> get_system_info( &info );
> return info.cpu_count;
>
> -#elif SYS_MACOSX || SYS_FREEBSD || SYS_OPENBSD
> +#elif SYS_MACOSX || SYS_FREEBSD
> int ncpu;
> size_t length = sizeof( ncpu );
> -#if SYS_OPENBSD
> - int mib[2] = { CTL_HW, HW_NCPU };
> - if( sysctl(mib, 2, &ncpu, &length, NULL, 0) )
> -#else
> if( sysctlbyname("hw.ncpu", &ncpu, &length, NULL, 0) )
> -#endif
> {
> ncpu = 1;
> }
Hi.
I created Merge Request for your 2 patches:
https://code.videolan.org/videolan/x264/-/merge_requests/64
I changed commit messages a bit. Patches look OK but as I don't
have/use OpenBSD than I can't say if they are correct for it.
But as most patches for OpenBSD are from you than I will trust your
expertise.
More information about the x264-devel
mailing list