pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
hashcat: partially fix the build for NetBSD
Module Name: pkgsrc-wip
Committed By: Pierre Pronchery <khorben%defora.org@localhost>
Pushed By: khorben
Date: Wed Jan 5 23:36:31 2022 +0100
Changeset: 48a0c5dd1826f268a47e2528eca53d7cd6200f2f
Modified Files:
hashcat/distinfo
hashcat/patches/patch-src_affinity.c
Log Message:
hashcat: partially fix the build for NetBSD
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=48a0c5dd1826f268a47e2528eca53d7cd6200f2f
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
hashcat/distinfo | 2 +-
hashcat/patches/patch-src_affinity.c | 78 ++++++++++++++++++++++++++++++++++--
2 files changed, 76 insertions(+), 4 deletions(-)
diffs:
diff --git a/hashcat/distinfo b/hashcat/distinfo
index 422863960a..02ab4c93c5 100644
--- a/hashcat/distinfo
+++ b/hashcat/distinfo
@@ -5,5 +5,5 @@ SHA512 (hashcat-6.2.5.tar.gz) = 2b881146c625172c91cb74b33851473155dcde2421fba1b4
Size (hashcat-6.2.5.tar.gz) = 6341872 bytes
SHA1 (patch-include_sort__r.h) = 710a6866d1f1b0ba4c499e07897cdaaed5d2f2cb
SHA1 (patch-src_Makefile) = 2781200f402b5cebaded0cce72023d6e1cda7ef9
-SHA1 (patch-src_affinity.c) = 83621bdd3f9a891cc80ef4a864c14864e917d6d8
+SHA1 (patch-src_affinity.c) = 6054fea2478244292bd855bb8eb8d064aa0d81d1
SHA1 (patch-src_folder.c) = 9db8506a5fa6aaceb05acb772ab4a58d8f3cac57
diff --git a/hashcat/patches/patch-src_affinity.c b/hashcat/patches/patch-src_affinity.c
index 2a9a18f327..736e40baf4 100644
--- a/hashcat/patches/patch-src_affinity.c
+++ b/hashcat/patches/patch-src_affinity.c
@@ -1,18 +1,90 @@
$NetBSD$
-Tentatively fix the build for NetBSD
+Fix the build for NetBSD
--- src/affinity.c.orig 2022-01-05 22:06:04.906472892 +0000
+++ src/affinity.c
-@@ -45,6 +45,11 @@ static int pthread_setaffinity_np (pthre
+@@ -45,6 +45,12 @@ static int pthread_setaffinity_np (pthre
typedef cpuset_t cpu_set_t;
#endif
+#if defined(__NetBSD__)
-+#include <sys/intrio.h>
++#include <pthread.h>
++#include <sched.h>
+typedef cpuset_t cpu_set_t;
+#endif
+
int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{
#if defined (__CYGWIN__)
+@@ -57,6 +63,10 @@ int set_cpu_affinity (MAYBE_UNUSED hashc
+ #if defined (_WIN)
+ DWORD_PTR aff_mask = 0;
+ const int cpu_id_max = 8 * sizeof (aff_mask);
++ #elif defined(__NetBSD__)
++ cpuset_t * cpuset;
++ const int cpu_id_max = 8 * cpuset_size (cpuset);
++ cpuset = cpuset_create();
+ #else
+ cpu_set_t cpuset;
+ const int cpu_id_max = 8 * sizeof (cpuset);
+@@ -79,6 +89,9 @@ int set_cpu_affinity (MAYBE_UNUSED hashc
+ {
+ #if defined (_WIN)
+ aff_mask = 0;
++ #elif defined (__NetBSD__)
++ cpuset_destroy (cpuset);
++ cpuset = cpuset_create ();
+ #else
+ CPU_ZERO (&cpuset);
+ #endif
+@@ -90,6 +103,10 @@ int set_cpu_affinity (MAYBE_UNUSED hashc
+ {
+ event_log_error (hashcat_ctx, "Invalid cpu_id %d specified.", cpu_id);
+
++ #if defined (__NetBSD__)
++ cpuset_destroy (cpuset);
++ #endif
++
+ hcfree (devices);
+
+ return -1;
+@@ -97,12 +114,18 @@ int set_cpu_affinity (MAYBE_UNUSED hashc
+
+ #if defined (_WIN)
+ aff_mask |= ((DWORD_PTR) 1) << (cpu_id - 1);
++ #elif defined (__NetBSD__)
++ cpuset_set (cpu_id - 1, cpuset);
+ #else
+ CPU_SET ((cpu_id - 1), &cpuset);
+ #endif
+
+ } while ((next = strtok_r ((char *) NULL, ",", &saveptr)) != NULL);
+
++ #if defined (__NetBSD__)
++ cpuset_destroy (cpuset);
++ #endif
++
+ hcfree (devices);
+
+ #if defined (_WIN)
+@@ -114,6 +137,19 @@ int set_cpu_affinity (MAYBE_UNUSED hashc
+ return -1;
+ }
+
++ #elif defined (__NetBSD__)
++
++ pthread_t thread = pthread_self ();
++
++ const int rc = pthread_setaffinity_np (thread, cpuset_size(cpuset), cpuset);
++
++ if (rc != 0)
++ {
++ event_log_error (hashcat_ctx, "pthread_setaffinity_np() failed with error: %d", rc);
++
++ return -1;
++ }
++
+ #else
+
+ pthread_t thread = pthread_self ();
Home |
Main Index |
Thread Index |
Old Index