mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Remove data. access from pthread_setaffinity_np (apple version)
This commit is contained in:
parent
dda89fe610
commit
9336ca8838
@ -7,6 +7,7 @@
|
|||||||
#define _AFFINITY_H
|
#define _AFFINITY_H
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef _POSIX
|
#ifdef _POSIX
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -170,9 +170,6 @@ char *strstatus (const uint threads_status);
|
|||||||
void status ();
|
void status ();
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN
|
|
||||||
void fsync (int fd);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void myabort (void);
|
void myabort (void);
|
||||||
void myquit (void);
|
void myquit (void);
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
* License.....: MIT
|
* License.....: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "types_int.h"
|
#include "types_int.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
@ -14,19 +18,20 @@ static int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t
|
|||||||
{
|
{
|
||||||
int core;
|
int core;
|
||||||
|
|
||||||
for (core = 0; core < (8 * (int)cpu_size); core++)
|
for (core = 0; core < (8 * (int) cpu_size); core++)
|
||||||
if (CPU_ISSET(core, cpu_set)) break;
|
{
|
||||||
|
if (CPU_ISSET (core, cpu_set)) break;
|
||||||
|
}
|
||||||
|
|
||||||
thread_affinity_policy_data_t policy = { core };
|
thread_affinity_policy_data_t policy = { core };
|
||||||
|
|
||||||
const int rc = thread_policy_set (pthread_mach_thread_np (thread), THREAD_AFFINITY_POLICY, (thread_policy_t) &policy, 1);
|
const int rc = thread_policy_set (pthread_mach_thread_np (thread), THREAD_AFFINITY_POLICY, (thread_policy_t) &policy, 1);
|
||||||
|
|
||||||
if (data.quiet == 0)
|
if (rc != KERN_SUCCESS)
|
||||||
{
|
{
|
||||||
if (rc != KERN_SUCCESS)
|
log_error ("ERROR: %s : %d", "thread_policy_set()", rc);
|
||||||
{
|
|
||||||
log_error ("ERROR: %s : %d", "thread_policy_set()", rc);
|
exit (-1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -41,7 +41,7 @@ extern hc_global_data_t data;
|
|||||||
|
|
||||||
|
|
||||||
#ifdef WIN
|
#ifdef WIN
|
||||||
void fsync (int fd)
|
static void fsync (int fd)
|
||||||
{
|
{
|
||||||
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
HANDLE h = (HANDLE) _get_osfhandle (fd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user