rtems libbsd gethostbyname did not work

葡萄 29171383 at qq.com
Thu Jun 30 13:42:35 UTC 2016


hi,I port a usb driver form freebsd for 4G dongle, it work ,but I cannot use gethostbyname ,I add some code for debug,find in freebsd/lib/libc/net/gethostnamadr.c line 581  _nsdispatch  return failure, in function _nsdispatch ,


if (isthreaded) {
		result = _pthread_rwlock_rdlock(&nss_lock);
		if (result != 0) {
			printf("nsdispatch pthread rd lock failure %d!\n",result);
			result = NS_UNAVAIL;
			goto fin;
		}
	}

_pthread_rwlock_rdlock  return invalid, can you give me some advise? how can i let gethostbyname work?
below is shell print for application information






tftp 0x81000000 rtems-app.img;bootm;
Auto negotitation failed
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 192.168.1.2; our IP address is 192.168.1.25
Filename 'rtems-app.img'.
Load address: 0x81000000
Loading: #################################################################
         ################################
done
Bytes transferred = 1415847 (159aa7 hex)
## Booting kernel from Legacy Image at 81000000 ...
   Image Name:   RTEMS
   Image Type:   ARM RTEMS Kernel Image (gzip compressed)
   Data Size:    1415783 Bytes = 1.4 MiB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Transferring control to RTEMS (at address 80000000) ...


RTEMS AM335X: am335x-card




RTEMS Kernel Image Booting




*** RTEMS Info ***
COPYRIGHT (c) 1989-2008.
On-Line Applications Research Corporation (OAR).
rtems-4.10.99.0(ARM/ARMv4/am335x)




 BSP Ticks Per Second = 100
*** End RTEMS info ***


fsmount: mounting of "/dev/nand1" to "/mnt/etc" succeeded
fsmount: mounting of "/dev/nand2" to "/mnt/data" succeeded
detect card on board,begin initial card ...!
initial card failure!
init mmc/sd device failure!
mmcsd_card_register: Error: SC = 13: Register disk SD Card driver
no disk register !
setup filesystem returned with status of 0.
load bmp 125 files
open index failure!
load cfg failure!
start dmtimer init!
clkctrl 44e00084 : clksel 44e0050c
start configure dmtimer 1!
register dmtimer period callback!
Starting RTEMS network configuration
nexus0: <RTEMS Nexus device>
cpsw0: <3-port Switch Ethernet Subsystem> on nexus0
sc->irq_res[0] = 80b0ed60
cpsw0: CPSW SS Version 1.12 (0)
cpsw0: Initial queue size TX=128 RX=384
cpswp0: <Ethernet Switch Port> on cpsw0
miibus0: <MII bus> on cpswp0
atphy0: <Atheros F1 10/100/1000 PHY> PHY 4 on miibus0
atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseSX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
devctl: +atphy0 at phyno=4 oui=0xc82e model=0x7 rev=0x2 on miibus0
devctl: +miibus0 at   on cpswp0
devctl: !system=IFNET subsystem=cpswp0 type=ATTACH
cpswp0: Ethernet address: -2141651040
devctl: +cpswp0 at   on cpsw0
cpswp1: <Ethernet Switch Port> on cpsw0
miibus1: <MII bus> on cpswp1
atphy1: <Atheros F1 10/100/1000 PHY> PHY 6 on miibus1
atphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseSX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
devctl: +atphy1 at phyno=6 oui=0xc82e model=0x7 rev=0x2 on miibus1
devctl: +miibus1 at   on cpswp1
devctl: !system=IFNET subsystem=cpswp1 type=ATTACH
cpswp1: Ethernet address: -2141651040
devctl: +cpswp1 at   on cpsw0
devctl: +cpsw0 at   on nexus0
usbss0: <TI AM33xx integrated USB OTG controller> on nexus0
usbss0: TI AM335X USBSS v0.0.13
musbotg0: <TI AM33xx integrated USB OTG controller> on usbss0
usbus0: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus0 on musbotg0
devctl: +usbus0 at   on musbotg0
devctl: +musbotg0 at   on usbss0
musbotg1: <TI AM33xx integrated USB OTG controller> on usbss0
usbus1: Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM
usbus1 on musbotg1
devctl: +usbus1 at   on musbotg1
devctl: +musbotg1 at   on usbss0
devctl: +usbss0 at   on nexus0
devctl: +nexus0 at   on root0
devctl: !system=IFNET subsystem=lo0 type=ATTACH
Device: /dev/pty0../dev/pty4 (5)pseudo-terminals registered.
telnetd started with stacksize = 81920 and priority = 198
info: ?: ftpd: FTP daemon started (4 sessions max)
web server start ...
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
webs begin of loop!


RTEMS Shell on /dev/console. Use 'help' to list commands.
[/] # uhub0: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub1: <Mentor Graphics OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
uhub0: 1 port with 1 removable, self powered
devctl: +uhub0 at   on usbus0
uhub1: 1 port with 1 removable, self powered
devctl: +uhub1 at   on usbus1
uhub2: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus1
uhub2: MTT enabled
uhub2: 4 ports with 4 removable, self powered
devctl: +uhub2 at bus=1 hubaddr=1 port=1 devaddr=2 interface=0 ugen=? vendor=0x0424 product=0x2514 devclass=0x09 devsubclass=0x00 sernum="" release=0x0bb3 mode=host intclass=0x09 intsubclass=0x00 intprotocol=0x02 on uhub1
cdce0: <USB-Ecm> on usbus1
devctl: +cdce0 at bus=2 hubaddr=4 port=1 devaddr=3 interface=0 ugen=? vendor=0x19d2 product=0x0536 devclass=0x02 devsubclass=0x00 sernum="ZTE" release=0x0100 mode=host intclass=0x02 intsubclass=0x06 intprotocol=0x00 on uhub2
ue0: <USB Ethernet> on cdce0
devctl: !system=IFNET subsystem=ue0 type=ATTACH
ue0: Ethernet address: -2134217956
ubser0: <USB-AT> on usbus1
AT
:
OK


AT+CIMI
:
+CIMI: 460021904851492


OK


AT+CMEE=1
:
OK


ATE0
:


OK


AT+CGDCONT=1,"IP","CMNET"
:
OK


AT+CFUN?
:
+CFUN: 1


OK


AT+CFUN=1
:
OK


AT^SYSCONFIG=2,2,1,3
:
OK


AT+CEREG=1
:
OK


AT+CGACT=1,1
:
OK


+ZGIPDNS: 1,1,"IP","10.129.178.121","0.0.0.0","112.4.1.36","112.4.12.200"


AT+ZGACT=1,1
:
OK


+ZCONSTAT: 1,1


devctl: +ubser0 at bus=2 hubaddr=4 port=1 devaddr=3 interface=2 ugen=? vendor=0x19d2 product=0x0536 devclass=0x02 devsubclass=0x00 sernum="ZTE" release=0x0100 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff on uhub2
devctl: ? at bus=2 hubaddr=4 port=1 devaddr=3 interface=3 ugen=? vendor=0x19d2 product=0x0536 devclass=0x02 devsubclass=0x00 sernum="ZTE" release=0x0100 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff on uhub2
devctl: ? at bus=2 hubaddr=4 port=1 devaddr=3 interface=4 ugen=? vendor=0x19d2 product=0x0536 devclass=0x02 devsubclass=0x00 sernum="ZTE" release=0x0100 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff on uhub2
info: dhcpcd: version 6.2.1 starting
info: dhcpcd: DUID 00:01:00:01:1e:85:d3:69:00:a0:c6:00:00:00
info: dhcpcd: ue0: IAID c6:00:00:00
info: dhcpcd: ue0: soliciting an IPv6 router
info: dhcpcd: ue0: soliciting a DHCP lease


[/] # 
[/] # 
[/] # 
[/] # info: dhcpcd: ue0: offered 10.129.178.121 from 10.129.179.121


[/] # 
[/] # 
[/] # 
[/] # info: dhcpcd: ue0: leased 10.129.178.121 for 86400 seconds
info: dhcpcd: ue0: adding host route to 10.129.178.121 via 127.0.0.1
info: dhcpcd: ue0: adding route to 10.129.0.0/16
err: dhcpcd: ue0: ipv4_addroute: File exists
info: dhcpcd: ue0: adding default route via 10.129.179.121
info: dhcpcd: ue0: removing default route via 10.129.179.121


[/] # 
[/] # 
[/] # 
[/] # ping www.baidu.com
nsdispatch pthread rd lock failure 22!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160630/cd0265cd/attachment.html>


More information about the users mailing list