Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/examples/rump/wirelessconf * use rump_boot_sethowto()
details: https://anonhg.NetBSD.org/src/rev/3e9647f6cd25
branches: trunk
changeset: 748734:3e9647f6cd25
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Nov 03 18:24:21 2009 +0000
description:
* use rump_boot_sethowto()
* fail in a nicer way if interface device is not probed
diffstat:
share/examples/rump/wirelessconf/wirelessconf.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diffs (59 lines):
diff -r 89f2ba7d1197 -r 3e9647f6cd25 share/examples/rump/wirelessconf/wirelessconf.c
--- a/share/examples/rump/wirelessconf/wirelessconf.c Tue Nov 03 18:23:15 2009 +0000
+++ b/share/examples/rump/wirelessconf/wirelessconf.c Tue Nov 03 18:24:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wirelessconf.c,v 1.2 2009/10/14 23:51:22 pooka Exp $ */
+/* $NetBSD: wirelessconf.c,v 1.3 2009/11/03 18:24:21 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -36,7 +36,9 @@
#include <rump/rump_syscalls.h>
#include <err.h>
+#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
/*
@@ -48,25 +50,32 @@
int
main(void)
{
- extern int rumpns_boothowto;
struct ifreq ifr;
int s;
- rumpns_boothowto = AB_VERBOSE;
+ rump_boot_sethowto(RUMP_AB_VERBOSE);
rump_init();
+
+ /* rum? shouldn't that be marsala? */
+ s = rump_sys_socket(AF_INET, SOCK_DGRAM, 0);
+ if (s == -1)
+ err(1, "socket");
+ strcpy(ifr.ifr_name, "rum0");
+ if (rump_sys_ioctl(s, SIOCGIFFLAGS, &ifr) == -1) {
+ if (errno == ENXIO) {
+ printf("rum@usb not found!\n");
+ exit(0);
+ }
+ err(1, "get if flags");
+ }
printf("\ndevice autoconfiguration finished\n");
printf("tira-if-su ...\n");
if (rump_pub_etfs_register(RUMFW, RUMFW, RUMP_ETFS_REG) != 0)
errx(1, "firmware etfs registration failed");
- /* rum? shouldn't that be marsala? */
strcpy(ifr.ifr_name, "rum0");
ifr.ifr_flags = IFF_UP;
- s = rump_sys_socket(AF_INET, SOCK_DGRAM, 0);
- if (s == -1)
- err(1, "socket");
-
if (rump_sys_ioctl(s, SIOCSIFFLAGS, &ifr) == -1)
err(1, "ioctl");
printf("... done\n");
Home |
Main Index |
Thread Index |
Old Index