Browse Source

Merge commit '385a70b' into cg_merges_20130818a

Conflicts:
	driver-avalon.c
	driver-bflsc.c
	driver-bitforce.c
	driver-modminer.c
	driver-opencl.c
	driver-ztex.c
	miner.c
	miner.h
Luke Dashjr 12 years ago
parent
commit
5c4c4fa008
5 changed files with 73 additions and 67 deletions
  1. 3 3
      driver-modminer.c
  2. 20 20
      driver-opencl.c
  3. 3 3
      driver-x6500.c
  4. 44 38
      miner.c
  5. 3 3
      miner.h

+ 3 - 3
driver-modminer.c

@@ -454,11 +454,11 @@ modminer_fpga_init(struct thr_info *thr)
 }
 }
 
 
 static
 static
-bool get_modminer_upload_percent(char *buf, struct cgpu_info *modminer, __maybe_unused bool per_processor)
+bool get_modminer_upload_percent(char *buf, size_t bufsz, struct cgpu_info *modminer, __maybe_unused bool per_processor)
 {
 {
 	char pdone = ((struct modminer_fpga_state*)(modminer->device->thr[0]->cgpu_data))->pdone;
 	char pdone = ((struct modminer_fpga_state*)(modminer->device->thr[0]->cgpu_data))->pdone;
 	if (pdone != 101) {
 	if (pdone != 101) {
-		tailsprintf(buf, "%3d%% ", pdone);
+		tailsprintf(buf, bufsz, "%3d%% ", pdone);
 		return true;
 		return true;
 	}
 	}
 	return false;
 	return false;
@@ -843,7 +843,7 @@ struct device_drv modminer_drv = {
 	.dname = "modminer",
 	.dname = "modminer",
 	.name = "MMQ",
 	.name = "MMQ",
 	.drv_detect = modminer_detect,
 	.drv_detect = modminer_detect,
-	.override_statline_temp = get_modminer_upload_percent,
+	.override_statline_temp2 = get_modminer_upload_percent,
 	.get_stats = modminer_get_stats,
 	.get_stats = modminer_get_stats,
 	.get_api_extra_device_status = get_modminer_drv_extra_device_status,
 	.get_api_extra_device_status = get_modminer_drv_extra_device_status,
 	.set_device = modminer_set_device,
 	.set_device = modminer_set_device,

+ 20 - 20
driver-opencl.c

@@ -846,7 +846,7 @@ void opencl_wlogprint_status(struct cgpu_info *cgpu)
 	char logline[255];
 	char logline[255];
 	strcpy(logline, ""); // In case it has no data
 	strcpy(logline, ""); // In case it has no data
 	
 	
-	tailsprintf(logline, "I:%s%d  ", (cgpu->dynamic ? "d" : ""), cgpu->intensity);
+	tailsprintf(logline, sizeof(logline), "I:%s%d  ", (cgpu->dynamic ? "d" : ""), cgpu->intensity);
 #ifdef HAVE_ADL
 #ifdef HAVE_ADL
 	if (cgpu->has_adl) {
 	if (cgpu->has_adl) {
 		int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0;
 		int engineclock = 0, memclock = 0, activity = 0, fanspeed = 0, fanpercent = 0, powertune = 0;
@@ -854,29 +854,29 @@ void opencl_wlogprint_status(struct cgpu_info *cgpu)
 
 
 		if (gpu_stats(cgpu->device_id, &temp, &engineclock, &memclock, &vddc, &activity, &fanspeed, &fanpercent, &powertune)) {
 		if (gpu_stats(cgpu->device_id, &temp, &engineclock, &memclock, &vddc, &activity, &fanspeed, &fanpercent, &powertune)) {
 			if (fanspeed != -1 || fanpercent != -1) {
 			if (fanspeed != -1 || fanpercent != -1) {
-				tailsprintf(logline, "F: ");
+				tailsprintf(logline, sizeof(logline), "F: ");
 				if (fanspeed > 9999)
 				if (fanspeed > 9999)
 					fanspeed = 9999;
 					fanspeed = 9999;
 				if (fanpercent != -1)
 				if (fanpercent != -1)
 				{
 				{
-					tailsprintf(logline, "%d%% ", fanpercent);
+					tailsprintf(logline, sizeof(logline), "%d%% ", fanpercent);
 					if (fanspeed != -1)
 					if (fanspeed != -1)
-						tailsprintf(logline, "(%d RPM) ", fanspeed);
+						tailsprintf(logline, sizeof(logline), "(%d RPM) ", fanspeed);
 				}
 				}
 				else
 				else
-					tailsprintf(logline, "%d RPM ", fanspeed);
-				tailsprintf(logline, " ");
+					tailsprintf(logline, sizeof(logline), "%d RPM ", fanspeed);
+				tailsprintf(logline, sizeof(logline), " ");
 			}
 			}
 			if (engineclock != -1)
 			if (engineclock != -1)
-				tailsprintf(logline, "E: %d MHz  ", engineclock);
+				tailsprintf(logline, sizeof(logline), "E: %d MHz  ", engineclock);
 			if (memclock != -1)
 			if (memclock != -1)
-				tailsprintf(logline, "M: %d MHz  ", memclock);
+				tailsprintf(logline, sizeof(logline), "M: %d MHz  ", memclock);
 			if (vddc != -1)
 			if (vddc != -1)
-				tailsprintf(logline, "V: %.3fV  ", vddc);
+				tailsprintf(logline, sizeof(logline), "V: %.3fV  ", vddc);
 			if (activity != -1)
 			if (activity != -1)
-				tailsprintf(logline, "A: %d%%  ", activity);
+				tailsprintf(logline, sizeof(logline), "A: %d%%  ", activity);
 			if (powertune != -1)
 			if (powertune != -1)
-				tailsprintf(logline, "P: %d%%", powertune);
+				tailsprintf(logline, sizeof(logline), "P: %d%%", powertune);
 		}
 		}
 	}
 	}
 #endif
 #endif
@@ -894,25 +894,25 @@ void opencl_wlogprint_status(struct cgpu_info *cgpu)
 		displayed_rolling = thr->rolling;
 		displayed_rolling = thr->rolling;
 		if (!mhash_base)
 		if (!mhash_base)
 			displayed_rolling *= 1000;
 			displayed_rolling *= 1000;
-		sprintf(logline, "Thread %d: %.1f %sh/s %s ", i, displayed_rolling, mhash_base ? "M" : "K" , cgpu->deven != DEV_DISABLED ? "Enabled" : "Disabled");
+		snprintf(logline, sizeof(logline), "Thread %d: %.1f %sh/s %s ", i, displayed_rolling, mhash_base ? "M" : "K" , cgpu->deven != DEV_DISABLED ? "Enabled" : "Disabled");
 		switch (cgpu->status) {
 		switch (cgpu->status) {
 			default:
 			default:
 			case LIFE_WELL:
 			case LIFE_WELL:
-				tailsprintf(logline, "ALIVE");
+				tailsprintf(logline, sizeof(logline), "ALIVE");
 				break;
 				break;
 			case LIFE_SICK:
 			case LIFE_SICK:
-				tailsprintf(logline, "SICK reported in %s", checkin);
+				tailsprintf(logline, sizeof(logline), "SICK reported in %s", checkin);
 				break;
 				break;
 			case LIFE_DEAD:
 			case LIFE_DEAD:
-				tailsprintf(logline, "DEAD reported in %s", checkin);
+				tailsprintf(logline, sizeof(logline), "DEAD reported in %s", checkin);
 				break;
 				break;
 			case LIFE_INIT:
 			case LIFE_INIT:
 			case LIFE_NOSTART:
 			case LIFE_NOSTART:
-				tailsprintf(logline, "Never started");
+				tailsprintf(logline, sizeof(logline), "Never started");
 				break;
 				break;
 		}
 		}
 		if (thr->pause)
 		if (thr->pause)
-			tailsprintf(logline, " paused");
+			tailsprintf(logline, sizeof(logline), " paused");
 		wlogprint("%s\n", logline);
 		wlogprint("%s\n", logline);
 	}
 	}
 }
 }
@@ -963,7 +963,7 @@ const char *opencl_tui_handle_choice(struct cgpu_info *cgpu, int input)
 			char logline[256];
 			char logline[256];
 			
 			
 			clear_logwin();
 			clear_logwin();
-			get_statline3(logline, cgpu, true, true);
+			get_statline3(logline, sizeof(logline), cgpu, true, true);
 			wattron(logwin, A_BOLD);
 			wattron(logwin, A_BOLD);
 			wlogprint("%s", logline);
 			wlogprint("%s", logline);
 			wattroff(logwin, A_BOLD);
 			wattroff(logwin, A_BOLD);
@@ -1426,7 +1426,7 @@ static void reinit_opencl_device(struct cgpu_info *gpu)
 
 
 // FIXME: Legacy (called by TUI) for side effects
 // FIXME: Legacy (called by TUI) for side effects
 static
 static
-bool override_opencl_statline_temp(char *buf, struct cgpu_info *gpu, __maybe_unused bool per_processor)
+bool override_opencl_statline_temp(char *buf, size_t bufsz, struct cgpu_info *gpu, __maybe_unused bool per_processor)
 {
 {
 #ifdef HAVE_SENSORS
 #ifdef HAVE_SENSORS
 	struct opencl_device_data *data = gpu->device_data;
 	struct opencl_device_data *data = gpu->device_data;
@@ -1759,7 +1759,7 @@ struct device_drv opencl_api = {
 	.name = "OCL",
 	.name = "OCL",
 	.drv_detect = opencl_detect,
 	.drv_detect = opencl_detect,
 	.reinit_device = reinit_opencl_device,
 	.reinit_device = reinit_opencl_device,
-	.override_statline_temp = override_opencl_statline_temp,
+	.override_statline_temp2 = override_opencl_statline_temp,
 #ifdef HAVE_CURSES
 #ifdef HAVE_CURSES
 	.proc_wlogprint_status = opencl_wlogprint_status,
 	.proc_wlogprint_status = opencl_wlogprint_status,
 	.proc_tui_wlogprint_choices = opencl_tui_wlogprint_choices,
 	.proc_tui_wlogprint_choices = opencl_tui_wlogprint_choices,

+ 3 - 3
driver-x6500.c

@@ -552,11 +552,11 @@ static bool x6500_get_stats(struct cgpu_info *x6500)
 }
 }
 
 
 static
 static
-bool get_x6500_upload_percent(char *buf, struct cgpu_info *x6500, __maybe_unused bool per_processor)
+bool get_x6500_upload_percent(char *buf, size_t bufsz, struct cgpu_info *x6500, __maybe_unused bool per_processor)
 {
 {
 	unsigned char pdone = *((unsigned char*)x6500->device_data - 1);
 	unsigned char pdone = *((unsigned char*)x6500->device_data - 1);
 	if (pdone != 101) {
 	if (pdone != 101) {
-		tailsprintf(buf, "%3d%% ", pdone);
+		tailsprintf(buf, bufsz, "%3d%% ", pdone);
 		return true;
 		return true;
 	}
 	}
 	return false;
 	return false;
@@ -822,7 +822,7 @@ struct device_drv x6500_api = {
 	.thread_prepare = x6500_prepare,
 	.thread_prepare = x6500_prepare,
 	.thread_init = x6500_thread_init,
 	.thread_init = x6500_thread_init,
 	.get_stats = x6500_get_stats,
 	.get_stats = x6500_get_stats,
-	.override_statline_temp = get_x6500_upload_percent,
+	.override_statline_temp2 = get_x6500_upload_percent,
 	.get_api_extra_device_status = get_x6500_api_extra_device_status,
 	.get_api_extra_device_status = get_x6500_api_extra_device_status,
 	.set_device = x6500_set_device,
 	.set_device = x6500_set_device,
 #ifdef HAVE_CURSES
 #ifdef HAVE_CURSES

+ 44 - 38
miner.c

@@ -2373,12 +2373,13 @@ int my_cancellable_getch(void)
 }
 }
 #endif
 #endif
 
 
-void tailsprintf(char *f, const char *fmt, ...)
+void tailsprintf(char *buf, size_t bufsz, const char *fmt, ...)
 {
 {
 	va_list ap;
 	va_list ap;
-
+	size_t presz = strlen(buf);
+	
 	va_start(ap, fmt);
 	va_start(ap, fmt);
-	vsprintf(f + strlen(f), fmt, ap);
+	vsnprintf(&buf[presz], bufsz - presz, fmt, ap);
 	va_end(ap);
 	va_end(ap);
 }
 }
 
 
@@ -2611,7 +2612,7 @@ static void adj_width(int var, int *length);
 static int awidth = 1, rwidth = 1, swidth = 1, hwwidth = 1;
 static int awidth = 1, rwidth = 1, swidth = 1, hwwidth = 1;
 
 
 static
 static
-void format_statline(char *buf, const char *cHr, const char *aHr, const char *uHr, int accepted, int rejected, int stale, int wnotaccepted, int waccepted, int hwerrs, int badnonces, int allnonces)
+void format_statline(char *buf, size_t bufsz, const char *cHr, const char *aHr, const char *uHr, int accepted, int rejected, int stale, int wnotaccepted, int waccepted, int hwerrs, int badnonces, int allnonces)
 {
 {
 	char rejpcbuf[6];
 	char rejpcbuf[6];
 	char bnbuf[6];
 	char bnbuf[6];
@@ -2621,7 +2622,7 @@ void format_statline(char *buf, const char *cHr, const char *aHr, const char *uH
 	adj_width(stale, &swidth);
 	adj_width(stale, &swidth);
 	adj_width(hwerrs, &hwwidth);
 	adj_width(hwerrs, &hwwidth);
 	
 	
-	tailsprintf(buf, "%s/%s/%s | A:%*d R:%*d+%*d(%s) HW:%*d/%s",
+	tailsprintf(buf, bufsz, "%s/%s/%s | A:%*d R:%*d+%*d(%s) HW:%*d/%s",
 	            cHr, aHr, uHr,
 	            cHr, aHr, uHr,
 	            awidth, accepted,
 	            awidth, accepted,
 	            rwidth, rejected,
 	            rwidth, rejected,
@@ -2634,26 +2635,26 @@ void format_statline(char *buf, const char *cHr, const char *aHr, const char *uH
 #endif
 #endif
 
 
 static inline
 static inline
-void temperature_column_tail(char *buf, bool maybe_unicode, const float * const temp)
+void temperature_column(char *buf, size_t bufsz, bool maybe_unicode, const float * const temp)
 {
 {
 	if (!(use_unicode && have_unicode_degrees))
 	if (!(use_unicode && have_unicode_degrees))
 		maybe_unicode = false;
 		maybe_unicode = false;
 	if (temp && *temp > 0.)
 	if (temp && *temp > 0.)
 		if (maybe_unicode)
 		if (maybe_unicode)
-			sprintf(buf, "%4.1f\xb0""C", *temp);
+			snprintf(buf, bufsz, "%4.1f\xb0""C", *temp);
 		else
 		else
-			sprintf(buf, "%4.1fC", *temp);
+			snprintf(buf, bufsz, "%4.1fC", *temp);
 	else
 	else
 	{
 	{
 		if (temp)
 		if (temp)
-			strcpy(buf, "     ");
+			snprintf(buf, bufsz, "     ");
 		if (maybe_unicode)
 		if (maybe_unicode)
-			strcat(buf, " ");
+			tailsprintf(buf, bufsz, " ");
 	}
 	}
-	strcat(buf, " | ");
+	tailsprintf(buf, bufsz, " | ");
 }
 }
 
 
-void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_show_procs)
+void get_statline3(char *buf, size_t bufsz, struct cgpu_info *cgpu, bool for_curses, bool opt_show_procs)
 {
 {
 #ifndef HAVE_CURSES
 #ifndef HAVE_CURSES
 	assert(for_curses == false);
 	assert(for_curses == false);
@@ -2716,33 +2717,38 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 	if (for_curses)
 	if (for_curses)
 	{
 	{
 		if (opt_show_procs)
 		if (opt_show_procs)
-			sprintf(buf, " %"PRIprepr": ", cgpu->proc_repr);
+			snprintf(buf, bufsz, " %"PRIprepr": ", cgpu->proc_repr);
 		else
 		else
-			sprintf(buf, " %s: ", cgpu->dev_repr);
+			snprintf(buf, bufsz, " %s: ", cgpu->dev_repr);
 	}
 	}
 	else
 	else
 #endif
 #endif
-		sprintf(buf, "%s ", opt_show_procs ? cgpu->proc_repr_ns : cgpu->dev_repr_ns);
+		snprintf(buf, bufsz, "%s ", opt_show_procs ? cgpu->proc_repr_ns : cgpu->dev_repr_ns);
 	
 	
 	if (unlikely(cgpu->status == LIFE_INIT))
 	if (unlikely(cgpu->status == LIFE_INIT))
 	{
 	{
-		tailsprintf(buf, "Initializing...");
+		tailsprintf(buf, bufsz, "Initializing...");
 		return;
 		return;
 	}
 	}
 	
 	
-	if (likely(cgpu->status != LIFE_DEAD2) && drv->override_statline_temp && drv->override_statline_temp(buf, cgpu, opt_show_procs))
-		temperature_column_tail(&buf[strlen(buf)], for_curses, NULL);
-	else
 	{
 	{
-		float temp = cgpu->temp;
-		if (!opt_show_procs)
+		const size_t bufln = strlen(buf);
+		const size_t abufsz = (bufln >= bufsz) ? 0 : (bufsz - bufln);
+		
+		if (likely(cgpu->status != LIFE_DEAD2) && drv->override_statline_temp2 && drv->override_statline_temp2(buf, bufsz, cgpu, opt_show_procs))
+			temperature_column(&buf[bufln], abufsz, for_curses, NULL);
+		else
 		{
 		{
-			// Find the highest temperature of all processors
-			for (struct cgpu_info *proc = cgpu; proc; proc = proc->next_proc)
-				if (proc->temp > temp)
-					temp = proc->temp;
+			float temp = cgpu->temp;
+			if (!opt_show_procs)
+			{
+				// Find the highest temperature of all processors
+				for (struct cgpu_info *proc = cgpu; proc; proc = proc->next_proc)
+					if (proc->temp > temp)
+						temp = proc->temp;
+			}
+			temperature_column(&buf[bufln], abufsz, for_curses, &temp);
 		}
 		}
-		temperature_column_tail(&buf[strlen(buf)], for_curses, &temp);
 	}
 	}
 	
 	
 #ifdef HAVE_CURSES
 #ifdef HAVE_CURSES
@@ -2786,7 +2792,7 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 		if (unlikely(all_off))
 		if (unlikely(all_off))
 			cHrStatsI = 2;
 			cHrStatsI = 2;
 		
 		
-		format_statline(buf,
+		format_statline(buf, bufsz,
 		                cHrStatsOpt[cHrStatsI],
 		                cHrStatsOpt[cHrStatsI],
 		                aHr, uHr,
 		                aHr, uHr,
 		                accepted, rejected, stale,
 		                accepted, rejected, stale,
@@ -2797,7 +2803,7 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 	else
 	else
 #endif
 #endif
 	{
 	{
-		tailsprintf(buf, "%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
+		tailsprintf(buf, bufsz, "%ds:%s avg:%s u:%s | A:%d R:%d+%d(%s) HW:%d/%s",
 			opt_log_interval,
 			opt_log_interval,
 			cHr, aHr, uHr,
 			cHr, aHr, uHr,
 			accepted,
 			accepted,
@@ -2810,8 +2816,8 @@ void get_statline3(char *buf, struct cgpu_info *cgpu, bool for_curses, bool opt_
 	}
 	}
 }
 }
 
 
-#define get_statline(buf, cgpu)               get_statline3(buf, cgpu, false, opt_show_procs)
-#define get_statline2(buf, cgpu, for_curses)  get_statline3(buf, cgpu, for_curses, opt_show_procs)
+#define get_statline(buf, bufsz, cgpu)               get_statline3(buf, bufsz, cgpu, false, opt_show_procs)
+#define get_statline2(buf, bufsz, cgpu, for_curses)  get_statline3(buf, bufsz, cgpu, for_curses, opt_show_procs)
 
 
 static void text_print_status(int thr_id)
 static void text_print_status(int thr_id)
 {
 {
@@ -2820,7 +2826,7 @@ static void text_print_status(int thr_id)
 
 
 	cgpu = get_thr_cgpu(thr_id);
 	cgpu = get_thr_cgpu(thr_id);
 	if (cgpu) {
 	if (cgpu) {
-		get_statline(logline, cgpu);
+		get_statline(logline, sizeof(logline), cgpu);
 		printf("%s\n", logline);
 		printf("%s\n", logline);
 	}
 	}
 }
 }
@@ -3036,7 +3042,7 @@ static void curses_print_devstatus(struct cgpu_info *cgpu)
 	if (wmove(statuswin, ypos, 0) == ERR)
 	if (wmove(statuswin, ypos, 0) == ERR)
 		return;
 		return;
 	
 	
-	get_statline2(logline, cgpu, true);
+	get_statline2(logline, sizeof(logline), cgpu, true);
 	if (selecting_device && (opt_show_procs ? (selected_device == cgpu->cgminer_id) : (devices[selected_device]->device == cgpu)))
 	if (selecting_device && (opt_show_procs ? (selected_device == cgpu->cgminer_id) : (devices[selected_device]->device == cgpu)))
 		wattron(statuswin, A_REVERSE);
 		wattron(statuswin, A_REVERSE);
 	bfg_waddstr(statuswin, logline);
 	bfg_waddstr(statuswin, logline);
@@ -3557,7 +3563,7 @@ static bool submit_upstream_work_completed(struct work *work, bool resubmit, str
 
 
 		cgpu = get_thr_cgpu(thr_id);
 		cgpu = get_thr_cgpu(thr_id);
 		
 		
-		get_statline(logline, cgpu);
+		get_statline(logline, sizeof(logline), cgpu);
 		applog(LOG_INFO, "%s", logline);
 		applog(LOG_INFO, "%s", logline);
 	}
 	}
 
 
@@ -6347,7 +6353,7 @@ refresh:
 	clear_logwin();
 	clear_logwin();
 	wlogprint("Select processor to manage using up/down arrow keys\n");
 	wlogprint("Select processor to manage using up/down arrow keys\n");
 	
 	
-	get_statline3(logline, cgpu, true, true);
+	get_statline3(logline, sizeof(logline), cgpu, true, true);
 	wattron(logwin, A_BOLD);
 	wattron(logwin, A_BOLD);
 	wlogprint("%s", logline);
 	wlogprint("%s", logline);
 	wattroff(logwin, A_BOLD);
 	wattroff(logwin, A_BOLD);
@@ -6654,7 +6660,7 @@ static void hashmeter(int thr_id, struct timeval *diff,
 
 
 				*last_msg_tv = now;
 				*last_msg_tv = now;
 
 
-				get_statline(logline, cgpu);
+				get_statline(logline, sizeof(logline), cgpu);
 				if (!curses_active) {
 				if (!curses_active) {
 					printf("%s          \r", logline);
 					printf("%s          \r", logline);
 					fflush(stdout);
 					fflush(stdout);
@@ -6744,9 +6750,9 @@ static void hashmeter(int thr_id, struct timeval *diff,
 			++divx;
 			++divx;
 		}
 		}
 		
 		
-		temperature_column_tail(&statusline[divx], true, &temp);
+		temperature_column(&statusline[divx], sizeof(statusline)-divx, true, &temp);
 		
 		
-		format_statline(statusline,
+		format_statline(statusline, sizeof(statusline),
 		                cHr, aHr,
 		                cHr, aHr,
 		                uHr,
 		                uHr,
 		                total_accepted,
 		                total_accepted,
@@ -8788,7 +8794,7 @@ static void log_print_status(struct cgpu_info *cgpu)
 {
 {
 	char logline[255];
 	char logline[255];
 
 
-	get_statline(logline, cgpu);
+	get_statline(logline, sizeof(logline), cgpu);
 	applog(LOG_WARNING, "%s", logline);
 	applog(LOG_WARNING, "%s", logline);
 }
 }
 
 

+ 3 - 3
miner.h

@@ -290,7 +290,7 @@ struct device_drv {
 
 
 	// Processor-specific functions
 	// Processor-specific functions
 	void (*reinit_device)(struct cgpu_info *);
 	void (*reinit_device)(struct cgpu_info *);
-	bool (*override_statline_temp)(char *buf, struct cgpu_info *, bool per_processor);
+	bool (*override_statline_temp2)(char *buf, size_t bufsz, struct cgpu_info *, bool per_processor);
 	struct api_data* (*get_api_extra_device_detail)(struct cgpu_info *);
 	struct api_data* (*get_api_extra_device_detail)(struct cgpu_info *);
 	struct api_data* (*get_api_extra_device_status)(struct cgpu_info *);
 	struct api_data* (*get_api_extra_device_status)(struct cgpu_info *);
 	struct api_data *(*get_api_stats)(struct cgpu_info *);
 	struct api_data *(*get_api_stats)(struct cgpu_info *);
@@ -1300,8 +1300,8 @@ extern struct work *find_queued_work_bymidstate(struct cgpu_info *cgpu, char *mi
 extern void work_completed(struct cgpu_info *cgpu, struct work *work);
 extern void work_completed(struct cgpu_info *cgpu, struct work *work);
 extern bool abandon_work(struct work *, struct timeval *work_runtime, uint64_t hashes);
 extern bool abandon_work(struct work *, struct timeval *work_runtime, uint64_t hashes);
 extern void hash_queued_work(struct thr_info *mythr);
 extern void hash_queued_work(struct thr_info *mythr);
-extern void get_statline3(char *buf, struct cgpu_info *, bool for_curses, bool opt_show_procs);
-extern void tailsprintf(char *f, const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 2, 3);
+extern void get_statline3(char *buf, size_t bufsz, struct cgpu_info *, bool for_curses, bool opt_show_procs);
+extern void tailsprintf(char *buf, size_t bufsz, const char *fmt, ...) FORMAT_SYNTAX_CHECK(printf, 3, 4);
 extern void _wlog(const char *str);
 extern void _wlog(const char *str);
 extern void _wlogprint(const char *str);
 extern void _wlogprint(const char *str);
 extern int curses_int(const char *query);
 extern int curses_int(const char *query);