summaryrefslogtreecommitdiff
path: root/multimedia/handbrake/files/patch-libhb-ports.c
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>2008-02-24 03:11:57 +0000
committercvs2svn <cvs2svn@FreeBSD.org>2008-02-24 03:11:57 +0000
commitfa4a943c17e47bf910596a414fd7287983350b9b (patch)
treedc76cec18a505befc330e612e0a56bf1caa5ca49 /multimedia/handbrake/files/patch-libhb-ports.c
parent- Fix manpage pointing to correct PREFIX for binary and conf (diff)
This commit was manufactured by cvs2svn to create tag 'RELEASE_7_0_0'.release/7.0.0
Diffstat (limited to 'multimedia/handbrake/files/patch-libhb-ports.c')
-rw-r--r--multimedia/handbrake/files/patch-libhb-ports.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/multimedia/handbrake/files/patch-libhb-ports.c b/multimedia/handbrake/files/patch-libhb-ports.c
new file mode 100644
index 000000000000..ac4b7ade63dc
--- /dev/null
+++ b/multimedia/handbrake/files/patch-libhb-ports.c
@@ -0,0 +1,46 @@
+--- HandBrake_old/libhb/ports.c 2007-10-08 22:57:08.000000000 +0200
++++ libhb/ports.c 2007-12-04 07:48:47.000000000 +0100
+@@ -28,6 +28,11 @@
+ #include <netinet/in.h>
+ //#endif
+
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #include "hb.h"
+
+ /************************************************************************
+@@ -105,21 +110,17 @@
+ cpu_count = info.cpu_count;
+ }
+
+-#elif defined( SYS_DARWIN ) || defined( SYS_FREEBSD )
+- FILE * info;
+- char buffer[16];
+-
+- if( ( info = popen( "/usr/sbin/sysctl hw.ncpu", "r" ) ) )
++#elif defined(__FreeBSD__)
+ {
+- memset( buffer, 0, 16 );
+- if( fgets( buffer, 15, info ) )
+- {
+- if( sscanf( buffer, "hw.ncpu: %d", &cpu_count ) != 1 )
+- {
+- cpu_count = 1;
+- }
+- }
+- fclose( info );
++ int mib[2];
++ size_t len;
++
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ len = sizeof(cpu_count);
++
++ if(sysctl(mib, 2, &cpu_count, &len, NULL, 0) != 0)
++ cpu_count = 1;
+ }
+
+ #elif defined( SYS_LINUX )