Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax/vax fix printf issues
details: https://anonhg.NetBSD.org/src/rev/8aeefc004425
branches: trunk
changeset: 794827:8aeefc004425
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 26 08:01:21 2014 +0000
description:
fix printf issues
diffstat:
sys/arch/vax/vax/db_disasm.c | 12 ++++++------
sys/arch/vax/vax/ka6400.c | 18 +++++++++++-------
sys/arch/vax/vax/ka820.c | 21 ++++++++++++---------
sys/arch/vax/vax/ka88.c | 19 +++++++++++--------
4 files changed, 40 insertions(+), 30 deletions(-)
diffs (222 lines):
diff -r ef0f81ab6c81 -r 8aeefc004425 sys/arch/vax/vax/db_disasm.c
--- a/sys/arch/vax/vax/db_disasm.c Wed Mar 26 03:19:11 2014 +0000
+++ b/sys/arch/vax/vax/db_disasm.c Wed Mar 26 08:01:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.20 2012/02/02 14:29:25 matt Exp $ */
+/* $NetBSD: db_disasm.c,v 1.21 2014/03/26 08:01:21 christos Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.20 2012/02/02 14:29:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.21 2014/03/26 08:01:21 christos Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -321,7 +321,7 @@
break;
case 4: /* indexed */
- sprintf(buf, "[%s]", my_db_regs[reg].name);
+ snprintf(buf, sizeof(buf), "[%s]", my_db_regs[reg].name);
get_operand(ib, 0);
add_str(ib, buf);
break;
@@ -477,9 +477,9 @@
{
char buf[32];
if (i < 100 && i > -100)
- sprintf(ib->curp, "%d", i);
+ snprintf(ib->curp, sizeof(buf), "%d", i);
else
- sprintf(buf, "0x%x", i);
+ snprintf(buf, sizeof(buf), "0x%x", i);
add_str(ib, buf);
}
@@ -487,7 +487,7 @@
add_xint(inst_buffer *ib, int val)
{
char buf[32];
- sprintf(buf, "0x%x", val);
+ snprintf(buf, sizeof(buf), "0x%x", val);
add_str(ib, buf);
}
diff -r ef0f81ab6c81 -r 8aeefc004425 sys/arch/vax/vax/ka6400.c
--- a/sys/arch/vax/vax/ka6400.c Wed Mar 26 03:19:11 2014 +0000
+++ b/sys/arch/vax/vax/ka6400.c Wed Mar 26 08:01:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ka6400.c,v 1.17 2014/03/24 20:06:33 christos Exp $ */
+/* $NetBSD: ka6400.c,v 1.18 2014/03/26 08:01:21 christos Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ka6400.c,v 1.17 2014/03/24 20:06:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka6400.c,v 1.18 2014/03/26 08:01:21 christos Exp $");
#include "opt_multiprocessor.h"
@@ -92,7 +92,7 @@
#if defined(MULTIPROCESSOR)
static void ka6400_startslave(struct cpu_info *);
-static void ka6400_txrx(int, const char *, int);
+static void ka6400_txrx(int, const char *, ...) __printflike(2, 3);
static void ka6400_sendstr(int, const char *);
static void ka6400_sergeant(int);
static int rxchar(void);
@@ -345,8 +345,8 @@
for (i = 0; i < 10000; i++)
if (rxchar())
i = 0;
- ka6400_txrx(id, "\020", 0); /* Send ^P to get attention */
- ka6400_txrx(id, "I\r", 0); /* Init other end */
+ ka6400_txrx(id, "\020"); /* Send ^P to get attention */
+ ka6400_txrx(id, "I\r"); /* Init other end */
ka6400_txrx(id, "D/I 4 %x\r", ci->ci_istack); /* Interrupt stack */
ka6400_txrx(id, "D/I C %x\r", mfpr(PR_SBR)); /* SBR */
ka6400_txrx(id, "D/I D %x\r", mfpr(PR_SLR)); /* SLR */
@@ -363,11 +363,15 @@
}
void
-ka6400_txrx(int id, const char *fmt, int arg)
+ka6400_txrx(int id, const char *fmt, ...)
{
char buf[20];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
- sprintf(buf, fmt, arg);
ka6400_sendstr(id, buf);
ka6400_sergeant(id);
}
diff -r ef0f81ab6c81 -r 8aeefc004425 sys/arch/vax/vax/ka820.c
--- a/sys/arch/vax/vax/ka820.c Wed Mar 26 03:19:11 2014 +0000
+++ b/sys/arch/vax/vax/ka820.c Wed Mar 26 08:01:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ka820.c,v 1.55 2014/03/24 20:06:33 christos Exp $ */
+/* $NetBSD: ka820.c,v 1.56 2014/03/26 08:01:21 christos Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ka820.c,v 1.55 2014/03/24 20:06:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka820.c,v 1.56 2014/03/26 08:01:21 christos Exp $");
#include "opt_multiprocessor.h"
@@ -98,7 +98,7 @@
#if defined(MULTIPROCESSOR)
static void ka820_startslave(struct cpu_info *);
static void ka820_send_ipi(struct cpu_info *);
-static void ka820_txrx(int, const char *, int);
+static void ka820_txrx(int, const char *, ...) __printflike(2, 3);
static void ka820_sendstr(int, const char *);
static void ka820_sergeant(int);
static int rxchar(void);
@@ -539,12 +539,12 @@
for (i = 0; i < 10000; i++)
if (rxchar())
i = 0;
- ka820_txrx(id, "\020", 0); /* Send ^P to get attention */
- ka820_txrx(id, "I\r", 0); /* Init other end */
- ka820_txrx(id, "D/I 4 %x\r", ci->ci_istack); /* Interrupt stack */
+ ka820_txrx(id, "\020"); /* Send ^P to get attention */
+ ka820_txrx(id, "I\r"); /* Init other end */
+ ka820_txrx(id, "D/I 4 %x\r", (int)ci->ci_istack); /* Interrupt stack */
ka820_txrx(id, "D/I C %x\r", mfpr(PR_SBR)); /* SBR */
ka820_txrx(id, "D/I D %x\r", mfpr(PR_SLR)); /* SLR */
- ka820_txrx(id, "D/I 10 %x\r", pcb->pcb_paddr); /* PCB for idle proc */
+ ka820_txrx(id, "D/I 10 %x\r", (int)pcb->pcb_paddr); /* PCB for idle proc */
ka820_txrx(id, "D/I 11 %x\r", mfpr(PR_SCBB)); /* SCB */
ka820_txrx(id, "D/I 38 %x\r", mfpr(PR_MAPEN)); /* Enable MM */
ka820_txrx(id, "S %x\r", (int)&vax_mp_tramp); /* Start! */
@@ -557,11 +557,14 @@
}
void
-ka820_txrx(int id, const char *fmt, int arg)
+ka820_txrx(int id, const char *fmt, ...)
{
char buf[20];
+ va_list ap;
- sprintf(buf, fmt, arg);
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
ka820_sendstr(id, buf);
ka820_sergeant(id);
}
diff -r ef0f81ab6c81 -r 8aeefc004425 sys/arch/vax/vax/ka88.c
--- a/sys/arch/vax/vax/ka88.c Wed Mar 26 03:19:11 2014 +0000
+++ b/sys/arch/vax/vax/ka88.c Wed Mar 26 08:01:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ka88.c,v 1.17 2014/03/24 20:06:33 christos Exp $ */
+/* $NetBSD: ka88.c,v 1.18 2014/03/26 08:01:21 christos Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ka88.c,v 1.17 2014/03/24 20:06:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ka88.c,v 1.18 2014/03/26 08:01:21 christos Exp $");
#include "opt_multiprocessor.h"
@@ -93,7 +93,7 @@
#if defined(MULTIPROCESSOR)
static void ka88_startslave(struct cpu_info *);
-static void ka88_txrx(int, const char *, int);
+static void ka88_txrx(int, const char *, ...) __printflike(2, 3);
static void ka88_sendstr(int, const char *);
static void ka88_sergeant(int);
static int rxchar(void);
@@ -379,8 +379,8 @@
for (i = 0; i < 10000; i++)
if (rxchar())
i = 0;
- ka88_txrx(id, "\020", 0); /* Send ^P to get attention */
- ka88_txrx(id, "I\r", 0); /* Init other end */
+ ka88_txrx(id, "\020"); /* Send ^P to get attention */
+ ka88_txrx(id, "I\r"); /* Init other end */
ka88_txrx(id, "D/I 4 %x\r", ci->ci_istack); /* Interrupt stack */
ka88_txrx(id, "D/I C %x\r", mfpr(PR_SBR)); /* SBR */
ka88_txrx(id, "D/I D %x\r", mfpr(PR_SLR)); /* SLR */
@@ -396,12 +396,15 @@
aprint_error_dev(ci->ci_dev, "(ID %d) failed starting!!\n", id);
}
-void
-ka88_txrx(int id, const char *fmt, int arg)
+static void
+ka88_txrx(int id, const char *fmt, ...)
{
char buf[20];
+ va_list ap;
- sprintf(buf, fmt, arg);
+ va_start(ap, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
ka88_sendstr(id, buf);
ka88_sergeant(id);
}
Home |
Main Index |
Thread Index |
Old Index