Browse Source

Merge commit '42891f0' into cg_merges_20130619a

Conflicts:
	miner.c
Luke Dashjr 12 years ago
parent
commit
338189cfbd
2 changed files with 10 additions and 9 deletions
  1. 1 0
      .gitignore
  2. 9 9
      miner.c

+ 1 - 0
.gitignore

@@ -47,6 +47,7 @@ lib/c++defs.h
 lib/libgnu.a
 lib/libgnu.a
 lib/signal.h
 lib/signal.h
 lib/string.h
 lib/string.h
+lib/stdint.h
 lib/warn-on-use.h
 lib/warn-on-use.h
 
 
 mkinstalldirs
 mkinstalldirs

+ 9 - 9
miner.c

@@ -69,7 +69,7 @@
 #include "ft232r.h"
 #include "ft232r.h"
 #endif
 #endif
 
 
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	#include <errno.h>
 	#include <errno.h>
 	#include <fcntl.h>
 	#include <fcntl.h>
 	#include <sys/wait.h>
 	#include <sys/wait.h>
@@ -324,7 +324,7 @@ static int include_count;
 #define JSON_MAX_DEPTH 10
 #define JSON_MAX_DEPTH 10
 #define JSON_MAX_DEPTH_ERR "Too many levels of JSON includes (limit 10) or a loop"
 #define JSON_MAX_DEPTH_ERR "Too many levels of JSON includes (limit 10) or a loop"
 
 
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	static char *opt_stderr_cmd = NULL;
 	static char *opt_stderr_cmd = NULL;
 	static int forkpid;
 	static int forkpid;
 #endif // defined(unix)
 #endif // defined(unix)
@@ -1376,7 +1376,7 @@ static struct opt_table opt_config_table[] = {
 	OPT_WITHOUT_ARG("--log-microseconds",
 	OPT_WITHOUT_ARG("--log-microseconds",
 	                opt_set_bool, &opt_log_microseconds,
 	                opt_set_bool, &opt_log_microseconds,
 	                "Include microseconds in log output"),
 	                "Include microseconds in log output"),
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	OPT_WITH_ARG("--monitor|-m",
 	OPT_WITH_ARG("--monitor|-m",
 		     opt_set_charp, NULL, &opt_stderr_cmd,
 		     opt_set_charp, NULL, &opt_stderr_cmd,
 		     "Use custom pipe cmd for output messages"),
 		     "Use custom pipe cmd for output messages"),
@@ -3647,7 +3647,7 @@ void app_restart(void)
 	__kill_work();
 	__kill_work();
 	clean_up();
 	clean_up();
 
 
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	if (forkpid > 0) {
 	if (forkpid > 0) {
 		kill(forkpid, SIGTERM);
 		kill(forkpid, SIGTERM);
 		forkpid = 0;
 		forkpid = 0;
@@ -5285,7 +5285,7 @@ void write_config(FILE *fcfg)
 		fputs(",\n\"round-robin\" : true", fcfg);
 		fputs(",\n\"round-robin\" : true", fcfg);
 	if (pool_strategy == POOL_ROTATE)
 	if (pool_strategy == POOL_ROTATE)
 		fprintf(fcfg, ",\n\"rotate\" : \"%d\"", opt_rotate_period);
 		fprintf(fcfg, ",\n\"rotate\" : \"%d\"", opt_rotate_period);
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	if (opt_stderr_cmd && *opt_stderr_cmd)
 	if (opt_stderr_cmd && *opt_stderr_cmd)
 		fprintf(fcfg, ",\n\"monitor\" : \"%s\"", json_escape(opt_stderr_cmd));
 		fprintf(fcfg, ",\n\"monitor\" : \"%s\"", json_escape(opt_stderr_cmd));
 #endif // defined(unix)
 #endif // defined(unix)
@@ -5780,7 +5780,7 @@ retry:
 
 
 void default_save_file(char *filename)
 void default_save_file(char *filename)
 {
 {
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	if (getenv("HOME") && *getenv("HOME")) {
 	if (getenv("HOME") && *getenv("HOME")) {
 	        strcpy(filename, getenv("HOME"));
 	        strcpy(filename, getenv("HOME"));
 		strcat(filename, "/");
 		strcat(filename, "/");
@@ -8212,7 +8212,7 @@ void quit(int status, const char *format, ...)
 		}
 		}
 	}
 	}
 
 
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 	if (forkpid > 0) {
 	if (forkpid > 0) {
 		kill(forkpid, SIGTERM);
 		kill(forkpid, SIGTERM);
 		forkpid = 0;
 		forkpid = 0;
@@ -8351,7 +8351,7 @@ out:
 }
 }
 #endif
 #endif
 
 
-#if defined(unix)
+#if defined(unix) || defined(__APPLE__)
 static void fork_monitor()
 static void fork_monitor()
 {
 {
 	// Make a pipe: [readFD, writeFD]
 	// Make a pipe: [readFD, writeFD]
@@ -8966,7 +8966,7 @@ int main(int argc, char *argv[])
 		openlog(PACKAGE, LOG_PID, LOG_USER);
 		openlog(PACKAGE, LOG_PID, LOG_USER);
 #endif
 #endif
 
 
-	#if defined(unix)
+	#if defined(unix) || defined(__APPLE__)
 		if (opt_stderr_cmd)
 		if (opt_stderr_cmd)
 			fork_monitor();
 			fork_monitor();
 	#endif // defined(unix)
 	#endif // defined(unix)