DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: dmesg WARNS6 cleanup


From: Peter Schuller <peter.schuller@xxxxxxxxxxxx>
Date: Sat, 8 Jan 2005 18:28:05 +0100

Apologies, got the wrong version of nlist.h. Here's the correct patch.

-- 
/ Peter Schuller, InfiDyne Technologies HB

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@xxxxxxxxxxxx>'
Key retrieval: Send an E-Mail to getpgpkey@xxxxxxxxx
E-Mail: peter.schuller@xxxxxxxxxxxx Web: http://www.scode.org

--- sbin/dmesg/dmesg.c.orig	2005-01-08 08:37:34.000000000 +0000
+++ sbin/dmesg/dmesg.c	2005-01-08 08:39:07.000000000 +0000
@@ -52,8 +52,8 @@
 
 struct nlist nl[] = {
 #define	X_MSGBUF	0
-	{ "_msgbufp" },
-	{ NULL },
+        NLIST_NAME("_msgbufp"),
+        NLIST_NULL,
 };
 
 void usage(void);
@@ -72,8 +72,7 @@
 	char buf[5];
 	int all = 0;
 	int pri = 0;
-	size_t buflen;
-	int bufpos;
+	size_t buflen, bufpos;
 
 	setlocale(LC_CTYPE, "");
 	memf = nlistf = NULL;
@@ -124,7 +123,7 @@
 		if (!bp)
 			errx(1, "malloc failed");
 		if (kvm_read(kd, (long)cur.msg_ptr, bp, cur.msg_size) !=
-		    cur.msg_size)
+		    (ssize_t)cur.msg_size)
 			errx(1, "kvm_read: %s", kvm_geterr(kd));
 		kvm_close(kd);
 		buflen = cur.msg_size;
--- include/nlist.h.orig	2005-01-08 08:33:27.000000000 +0000
+++ include/nlist.h	2005-01-08 09:11:42.000000000 +0000
@@ -68,6 +68,12 @@
 	unsigned long n_value;	/* address/value of the symbol */
 };
 
+/* Initializes an nlist with the given n_name but otherwise zeroed */
+#define NLIST_NAME(name) { name, 0, '\0', 0, 0 }
+
+/* Terminates arrays of nlist structures */
+#define NLIST_NULL { NULL, 0, '\0', 0, 0 }
+
 #define	n_hash	n_desc		/* used internally by ld(1); XXX */
 
 /*


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]