diff --git a/ccminer.cpp b/ccminer.cpp index c76adb7..49a0ca9 100644 --- a/ccminer.cpp +++ b/ccminer.cpp @@ -3227,7 +3227,7 @@ int main(int argc, char *argv[]) } #ifdef USE_WRAPNVML -#ifndef WIN32 +#if defined(__linux__) || defined(_WIN64) /* nvml is currently not the best choice on Windows (only in x64) */ hnvml = nvml_create(); if (hnvml) { @@ -3237,11 +3237,12 @@ int main(int argc, char *argv[]) cuda_reset_device(n, NULL); } } -#else - if (nvapi_init() == 0) +#endif +#ifdef WIN32 + if (!hnvml && nvapi_init() == 0) applog(LOG_INFO, "NVAPI GPU monitoring enabled."); #endif - else + else if (!hnvml) applog(LOG_INFO, "GPU monitoring is not available."); #endif diff --git a/compat/getopt/getopt_long.c b/compat/getopt/getopt_long.c index 90fc0cf..a78ec8f 100644 --- a/compat/getopt/getopt_long.c +++ b/compat/getopt/getopt_long.c @@ -54,42 +54,39 @@ static const char rcsid[]="$Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney E * POSSIBILITY OF SUCH DAMAGE. */ -#if 0 -#include -#endif #include #include #include #include -#ifdef _WIN32 - -/* Windows needs warnx(). We change the definition though: - * 1. (another) global is defined, opterrmsg, which holds the error message - * 2. errors are always printed out on stderr w/o the program name - * Note that opterrmsg always gets set no matter what opterr is set to. The - * error message will not be printed if opterr is 0 as usual. - */ - -#include -#include -#include - -char opterrmsg[128]; /* last error message is stored here */ - -static void warnx(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - if (fmt != NULL) - _vsnprintf(opterrmsg, 128, fmt, ap); - else - opterrmsg[0]='\0'; - va_end(ap); - fprintf(stderr, opterrmsg); - fprintf(stderr, "\n"); -} - +#ifdef _WIN32 + +/* Windows needs warnx(). We change the definition though: + * 1. (another) global is defined, opterrmsg, which holds the error message + * 2. errors are always printed out on stderr w/o the program name + * Note that opterrmsg always gets set no matter what opterr is set to. The + * error message will not be printed if opterr is 0 as usual. + */ + +#include +#include +#include + +char opterrmsg[128]; /* last error message is stored here */ + +static void warnx(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + if (fmt != NULL) + _vsnprintf(opterrmsg, 128, fmt, ap); + else + opterrmsg[0]='\0'; + va_end(ap); + fprintf(stderr, opterrmsg); + fprintf(stderr, "\n"); +} + #endif /*_WIN32*/ #define REPLACE_GETOPT /* use this getopt as the system getopt(3) */