"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "auxil/highwayhash/highwayhash/os_mac.cc" between
zeek-4.0.2.tar.gz and zeek-4.0.3.tar.gz

About: Zeek (formerly Bro) is a flexible network analysis framework focusing on network security monitoring. LTS (Long Term Support) release.

os_mac.cc  (zeek-4.0.2):os_mac.cc  (zeek-4.0.3)
skipping to change at line 17 skipping to change at line 17
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// Created by Alexander Gryanko on 16/09/2017. // Created by Alexander Gryanko on 16/09/2017.
#include "os_mac.h" #include "highwayhash/os_mac.h"
int mac_getaffinity(cpu_set_t* set) { int mac_getaffinity(cpu_set_t* set) {
int64_t core_count = 0; int64_t core_count = 0;
size_t core_count_size = sizeof(core_count); // size is a pointer size_t core_count_size = sizeof(core_count); // size is a pointer
const int err = sysctlbyname(SYSCTL_CORE_COUNT, &core_count, const int err =
&core_count_size, NULL, 0); sysctlbyname(SYSCTL_CORE_COUNT, &core_count, &core_count_size, NULL, 0);
if (err != 0) if (err != 0) return err;
return err;
CPU_ZERO(set); CPU_ZERO(set);
for (int64_t i = 0; i < core_count; ++i) { for (int64_t i = 0; i < core_count; ++i) {
CPU_SET(i, set); CPU_SET(i, set);
} }
return 0; return 0;
} }
int mac_setaffinity(cpu_set_t* set) { int mac_setaffinity(cpu_set_t* set) {
thread_port_t thread = pthread_mach_thread_np(pthread_self()); thread_port_t thread = pthread_mach_thread_np(pthread_self());
uint16_t current_core; uint16_t current_core;
for (current_core = 0; current_core < NR_CPUS; ++current_core) { for (current_core = 0; current_core < NR_CPUS; ++current_core) {
if (CPU_ISSET(current_core, set)) break; if (CPU_ISSET(current_core, set)) break;
} }
thread_affinity_policy_data_t policy = { current_core }; thread_affinity_policy_data_t policy = {current_core};
return thread_policy_set(thread, THREAD_AFFINITY_POLICY, return thread_policy_set(thread, THREAD_AFFINITY_POLICY,
(thread_policy_t)&policy, 1); (thread_policy_t)&policy, 1);
} }
 End of changes. 4 change blocks. 
8 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)