Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/shmif_dumpbus make portable
details: https://anonhg.NetBSD.org/src/rev/f894bddda37f
branches: trunk
changeset: 325365:f894bddda37f
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Dec 20 10:04:33 2013 +0000
description:
make portable
diffstat:
usr.bin/shmif_dumpbus/shmif_dumpbus.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diffs (67 lines):
diff -r 8e5465329b3d -r f894bddda37f usr.bin/shmif_dumpbus/shmif_dumpbus.c
--- a/usr.bin/shmif_dumpbus/shmif_dumpbus.c Fri Dec 20 10:00:59 2013 +0000
+++ b/usr.bin/shmif_dumpbus/shmif_dumpbus.c Fri Dec 20 10:04:33 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: shmif_dumpbus.c,v 1.10 2013/12/20 09:36:03 pooka Exp $ */
+/* $NetBSD: shmif_dumpbus.c,v 1.11 2013/12/20 10:04:33 pooka Exp $ */
/*-
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
@@ -30,15 +30,18 @@
* examined with tcpdump -r, wireshark, etc.
*/
+#include <rump/rumpuser_port.h>
+
#ifndef lint
-__RCSID("$NetBSD: shmif_dumpbus.c,v 1.10 2013/12/20 09:36:03 pooka Exp $");
+__RCSID("$NetBSD: shmif_dumpbus.c,v 1.11 2013/12/20 10:04:33 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
-
-#include <machine/bswap.h>
+#ifdef __NetBSD__
+#include <sys/bswap.h>
+#endif
#include <assert.h>
#include <err.h>
@@ -57,13 +60,24 @@
usage(void)
{
+#ifndef PLATFORM_HAS_SETGETPROGNAME
+#define getprogname() "shmif_dumpbus"
+#endif
+
fprintf(stderr, "usage: %s [-h] [-p pcapfile] buspath\n",getprogname());
exit(1);
}
#define BUFSIZE 64*1024
+#ifdef __NetBSD__
#define SWAPME(a) (doswap ? bswap32(a) : (a))
#define SWAPME64(a) (doswap ? bswap64(a) : (a))
+#else
+/* lazy, but let's assume everyone uses shmif_dumpbus only locally */
+#define SWAPME(a) (a)
+#define SWAPME64(a) (a)
+#define bswap32(a) (a)
+#endif
int
main(int argc, char *argv[])
{
@@ -79,7 +93,10 @@
pcap_dumper_t *pdump;
FILE *dumploc = stdout;
+#ifdef PLATFORM_HAS_SETGETPROGNAME
setprogname(argv[0]);
+#endif
+
while ((ch = getopt(argc, argv, "hp:")) != -1) {
switch (ch) {
case 'h':
Home |
Main Index |
Thread Index |
Old Index