Date: Mon, 6 Feb 2017 14:47:24 +0000 (UTC) From: "Vanilla I. Shu" <vanilla@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r433492 - in head/devel/pecl-swoole: . files Message-ID: <201702061447.v16ElPZ5011325@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vanilla Date: Mon Feb 6 14:47:24 2017 New Revision: 433492 URL: https://svnweb.freebsd.org/changeset/ports/433492 Log: Enable cpu affinity function. Added: head/devel/pecl-swoole/files/patch-include_swoole.h (contents, props changed) head/devel/pecl-swoole/files/patch-src_network_Server.c (contents, props changed) head/devel/pecl-swoole/files/patch-swoole__process.c (contents, props changed) Modified: head/devel/pecl-swoole/Makefile head/devel/pecl-swoole/files/patch-config.m4 Modified: head/devel/pecl-swoole/Makefile ============================================================================== --- head/devel/pecl-swoole/Makefile Mon Feb 6 14:32:00 2017 (r433491) +++ head/devel/pecl-swoole/Makefile Mon Feb 6 14:47:24 2017 (r433492) @@ -3,6 +3,7 @@ PORTNAME= swoole PORTVERSION= 1.9.5 +PORTREVISION= 1 CATEGORIES= devel net MASTER_SITES= http://pecl.php.net/get/ PKGNAMEPREFIX= pecl- Modified: head/devel/pecl-swoole/files/patch-config.m4 ============================================================================== --- head/devel/pecl-swoole/files/patch-config.m4 Mon Feb 6 14:32:00 2017 (r433491) +++ head/devel/pecl-swoole/files/patch-config.m4 Mon Feb 6 14:47:24 2017 (r433492) @@ -1,6 +1,20 @@ ---- config.m4.orig 2017-02-05 15:08:47 UTC +--- config.m4.orig 2017-01-24 02:05:48 UTC +++ config.m4 -@@ -178,7 +178,7 @@ if test "$PHP_SWOOLE" != "no"; then +@@ -85,7 +85,13 @@ AC_DEFUN([AC_SWOOLE_CPU_AFFINITY], + AC_MSG_CHECKING([for cpu affinity]) + AC_TRY_COMPILE( + [ ++ #ifdef __FreeBSD__ ++ #include <sys/types.h> ++ #include <sys/cpuset.h> ++ typedef cpuset_t cpu_set_t; ++ #else + #include <sched.h> ++ #endif + ], [ + cpu_set_t cpu_set; + CPU_ZERO(&cpu_set); +@@ -178,7 +184,7 @@ if test "$PHP_SWOOLE" != "no"; then AC_CHECK_LIB(c, poll, AC_DEFINE(HAVE_POLL, 1, [have poll])) AC_CHECK_LIB(c, sendfile, AC_DEFINE(HAVE_SENDFILE, 1, [have sendfile])) AC_CHECK_LIB(c, kqueue, AC_DEFINE(HAVE_KQUEUE, 1, [have kqueue])) Added: head/devel/pecl-swoole/files/patch-include_swoole.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/pecl-swoole/files/patch-include_swoole.h Mon Feb 6 14:47:24 2017 (r433492) @@ -0,0 +1,20 @@ +--- include/swoole.h.orig 2017-01-24 02:05:48 UTC ++++ include/swoole.h +@@ -40,7 +40,17 @@ extern "C" { + #include <assert.h> + #include <time.h> + #include <pthread.h> ++ ++#if defined(HAVE_CPU_AFFINITY) ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/cpuset.h> ++#include <pthread_np.h> ++typedef cpuset_t cpu_set_t; ++#else + #include <sched.h> ++#endif ++#endif + + #include <arpa/inet.h> + #include <netinet/in.h> Added: head/devel/pecl-swoole/files/patch-src_network_Server.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/pecl-swoole/files/patch-src_network_Server.c Mon Feb 6 14:47:24 2017 (r433492) @@ -0,0 +1,16 @@ +--- src/network/Server.c.orig 2017-02-06 09:30:50 UTC ++++ src/network/Server.c +@@ -522,7 +522,13 @@ int swServer_worker_init(swServer *serv, + { + CPU_SET(SwooleWG.id % SW_CPU_NUM, &cpu_set); + } ++ ++#ifdef __FreeBSD__ ++ if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, ++ sizeof(cpu_set), &cpu_set) < 0) ++#else + if (sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) < 0) ++#endif + { + swSysError("sched_setaffinity() failed."); + } Added: head/devel/pecl-swoole/files/patch-swoole__process.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/pecl-swoole/files/patch-swoole__process.c Mon Feb 6 14:47:24 2017 (r433492) @@ -0,0 +1,15 @@ +--- swoole_process.c.orig 2017-02-06 09:32:48 UTC ++++ swoole_process.c +@@ -963,7 +963,12 @@ static PHP_METHOD(swoole_process, setaff + CPU_SET(Z_LVAL_P(value), &cpu_set); + SW_HASHTABLE_FOREACH_END(); + ++#ifdef __FreeBSD__ ++ if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, ++ sizeof(cpu_set), &cpu_set) < 0) ++#else + if (sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) < 0) ++#endif + { + swoole_php_sys_error(E_WARNING, "sched_setaffinity() failed."); + RETURN_FALSE;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702061447.v16ElPZ5011325>