Con Kolivas 13 years ago
parent
commit
28796de72e
  1. 10
      main.c
  2. 8
      miner.h

10
main.c

@ -3487,7 +3487,6 @@ static void hashmeter(int thr_id, struct timeval *diff,
static double local_mhashes_done = 0; static double local_mhashes_done = 0;
static double rolling = 0; static double rolling = 0;
double local_mhashes = (double)hashes_done / 1000000.0; double local_mhashes = (double)hashes_done / 1000000.0;
struct cgpu_info *cgpu = thr_info[thr_id].cgpu;
bool showlog = false; bool showlog = false;
/* Update the last time this thread reported in */ /* Update the last time this thread reported in */
@ -3503,6 +3502,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
/* So we can call hashmeter from a non worker thread */ /* So we can call hashmeter from a non worker thread */
if (thr_id >= 0) { if (thr_id >= 0) {
struct thr_info *thr = &thr_info[thr_id]; struct thr_info *thr = &thr_info[thr_id];
struct cgpu_info *cgpu = thr_info[thr_id].cgpu;
double thread_rolling = 0.0; double thread_rolling = 0.0;
int i; int i;
@ -5259,6 +5259,8 @@ int main (int argc, char *argv[])
init_max_name_len(); init_max_name_len();
handler.sa_handler = &sighandler; handler.sa_handler = &sighandler;
handler.sa_flags = 0;
sigemptyset(&handler.sa_mask);
sigaction(SIGTERM, &handler, &termhandler); sigaction(SIGTERM, &handler, &termhandler);
sigaction(SIGINT, &handler, &inthandler); sigaction(SIGINT, &handler, &inthandler);
@ -5396,6 +5398,7 @@ int main (int argc, char *argv[])
} else } else
chosen_kernel = KL_NONE; chosen_kernel = KL_NONE;
#ifdef HAVE_OPENCL
gpu_threads = nDevs * opt_g_threads; gpu_threads = nDevs * opt_g_threads;
if (total_devices) { if (total_devices) {
if (total_devices > nDevs) if (total_devices > nDevs)
@ -5418,6 +5421,9 @@ int main (int argc, char *argv[])
gpu_devices[i] = true; gpu_devices[i] = true;
total_devices = nDevs; total_devices = nDevs;
} }
#else
gpu_threads = 0;
#endif
if (!gpu_threads && !forced_n_threads) { if (!gpu_threads && !forced_n_threads) {
/* Maybe they turned GPU off; restore default CPU threads. */ /* Maybe they turned GPU off; restore default CPU threads. */
@ -5456,7 +5462,7 @@ int main (int argc, char *argv[])
quit(1, "Failed to malloc userpass"); quit(1, "Failed to malloc userpass");
sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass); sprintf(pool->rpc_userpass, "%s:%s", pool->rpc_user, pool->rpc_pass);
} else { } else {
pool->rpc_user = malloc(strlen(pool->rpc_userpass)); pool->rpc_user = malloc(strlen(pool->rpc_userpass) + 1);
if (!pool->rpc_user) if (!pool->rpc_user)
quit(1, "Failed to malloc user"); quit(1, "Failed to malloc user");
strcpy(pool->rpc_user, pool->rpc_userpass); strcpy(pool->rpc_user, pool->rpc_userpass);

8
miner.h

@ -81,7 +81,9 @@ void *alloca (size_t);
#endif #endif
#if !defined(WIN32) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) #if !defined(WIN32) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP #define bswap_16 __builtin_bswap16
#define bswap_32 __builtin_bswap32
#define bswap_64 __builtin_bswap64
#else #else
#if HAVE_BYTESWAP_H #if HAVE_BYTESWAP_H
#include <byteswap.h> #include <byteswap.h>
@ -244,11 +246,7 @@ extern void thr_info_cancel(struct thr_info *thr);
static inline uint32_t swab32(uint32_t v) static inline uint32_t swab32(uint32_t v)
{ {
#ifdef WANT_BUILTIN_BSWAP
return __builtin_bswap32(v);
#else
return bswap_32(v); return bswap_32(v);
#endif
} }
static inline void swap256(void *dest_p, const void *src_p) static inline void swap256(void *dest_p, const void *src_p)

Loading…
Cancel
Save