EzDevInfo.com

openwrt interview questions

Top openwrt frequently asked interview questions

pjsip pjsua USB SoundCard choopy

the pjsua runs in openwrt, we use USB SoundCard.
When we answer a call, allways choopy, both the capture and the playback are not work well!

Tips:We have use auddemo tested my soundcard, recoreding/playing are good, and the capture id is 8, playback id is 1.
thank you~~

below is logs:

11:58:06.357    dlg0xdb687c  .Received Request msg ACK/cseq=103 (rdata0xdb3ecc)
11:58:06.360   strm0xe038dc !Start talksprut..
11:58:06.361          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:06.363     alsa_dev.c  pb_thread_func: underrun!
11:58:06.587   Master/sound !160 samples reduced, buf_cnt=1888
11:58:06.587   Master/sound  Buffer size adjusted from 2048 to 1888 (eff_cnt=1280)
11:58:06.588     alsa_dev.c  ca_thread_func: overrun!
11:58:06.756     alsa_dev.c  ca_thread_func: overrun!
11:58:06.968   Master/sound  228 samples reduced, buf_cnt=1980
11:58:06.968   Master/sound  Buffer size adjusted from 2208 to 1980 (eff_cnt=1280)
11:58:06.968     alsa_dev.c  ca_thread_func: overrun!
11:58:06.981          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:07.083   Master/sound  317 samples reduced, buf_cnt=1983
11:58:07.083     alsa_dev.c  ca_thread_func: overrun!
11:58:07.098          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.321   Master/sound !280 samples reduced, buf_cnt=1703
11:58:07.321   Master/sound  Buffer size adjusted from 1983 to 1703 (eff_cnt=1280)
11:58:07.321     alsa_dev.c  ca_thread_func: overrun!
11:58:07.493     alsa_dev.c  ca_thread_func: overrun!
11:58:07.505          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:07.707   Master/sound !182 samples reduced, buf_cnt=2161
11:58:07.711     alsa_dev.c  ca_thread_func: overrun!
11:58:07.506     alsa_dev.c !pb_thread_func: underrun!
11:58:07.936   Master/sound !376 samples reduced, buf_cnt=1785
11:58:07.937   Master/sound  Buffer size adjusted from 2161 to 1785 (eff_cnt=1280)
11:58:07.937     alsa_dev.c  ca_thread_func: overrun!
11:58:07.950          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.001          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.099   Master/sound  467 samples reduced, buf_cnt=1958
11:58:08.100     alsa_dev.c  ca_thread_func: overrun!
11:58:08.108          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.331   Master/sound !390 samples reduced, buf_cnt=1568
11:58:08.332   Master/sound  Buffer size adjusted from 1958 to 1568 (eff_cnt=1280)
11:58:08.332     alsa_dev.c  ca_thread_func: overrun!
11:58:08.508     alsa_dev.c  ca_thread_func: overrun!
11:58:08.521          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.574          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:08.677   Master/sound  320 samples reduced, buf_cnt=2208
11:58:08.677     alsa_dev.c  ca_thread_func: overrun!
11:58:08.688          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:08.915   Master/sound !499 samples reduced, buf_cnt=2029
11:58:08.915     alsa_dev.c  ca_thread_func: overrun!
11:58:09.128   Master/sound  193 samples reduced, buf_cnt=1836
11:58:09.128   Master/sound  Buffer size adjusted from 2029 to 1836 (eff_cnt=1280)
11:58:09.129     alsa_dev.c  ca_thread_func: overrun!
11:58:09.142          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.197          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.300   Master/sound  257 samples reduced, buf_cnt=2219
11:58:09.300     alsa_dev.c  ca_thread_func: overrun!
11:58:09.308          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:09.309     alsa_dev.c  pb_thread_func: underrun!
11:58:09.523   Master/sound !427 samples reduced, buf_cnt=1792
11:58:09.523   Master/sound  Buffer size adjusted from 2219 to 1792 (eff_cnt=1280)
11:58:09.523     alsa_dev.c  ca_thread_func: overrun!
11:58:09.718     alsa_dev.c  ca_thread_func: overrun!
11:58:09.731          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:09.832   Master/sound  297 samples reduced, buf_cnt=2135
11:58:09.833     alsa_dev.c  ca_thread_func: overrun!
11:58:09.845          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.080   Master/sound !160 samples reduced, buf_cnt=1975
11:58:10.080   Master/sound  Buffer size adjusted from 2135 to 1975 (eff_cnt=1280)
11:58:10.080     alsa_dev.c  ca_thread_func: overrun!
11:58:10.316   Master/sound  110 samples reduced, buf_cnt=2185
11:58:10.316     alsa_dev.c  ca_thread_func: overrun!
11:58:10.329          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.427   Master/sound  527 samples reduced, buf_cnt=1978
11:58:10.427          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:10.530   Master/sound  142 samples reduced, buf_cnt=2156
11:58:10.531     alsa_dev.c  ca_thread_func: overrun!
11:58:10.538          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:10.768   Master/sound !169 samples reduced, buf_cnt=1987
11:58:10.768   Master/sound  Buffer size adjusted from 2156 to 1987 (eff_cnt=1280)
11:58:10.769     alsa_dev.c  ca_thread_func: overrun!
11:58:11.004   Master/sound  67 samples reduced, buf_cnt=2240
11:58:11.005     alsa_dev.c  ca_thread_func: overrun!
11:58:11.017          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:11.117   Master/sound  439 samples reduced, buf_cnt=2121
11:58:11.118     alsa_dev.c  ca_thread_func: overrun!
11:58:11.124          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.125     alsa_dev.c  pb_thread_func: underrun!
11:58:11.349   Master/sound !162 samples reduced, buf_cnt=1959
11:58:11.349   Master/sound  Buffer size adjusted from 2121 to 1959 (eff_cnt=1280)
11:58:11.349     alsa_dev.c  ca_thread_func: overrun!
11:58:11.574   Master/sound  39 samples reduced, buf_cnt=2240
11:58:11.575     alsa_dev.c  ca_thread_func: overrun!
11:58:11.584          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:11.809   Master/sound !423 samples reduced, buf_cnt=1817
11:58:11.810   Master/sound  Buffer size adjusted from 2240 to 1817 (eff_cnt=1280)
11:58:11.810     alsa_dev.c  ca_thread_func: overrun!
11:58:11.984     alsa_dev.c  ca_thread_func: overrun!
11:58:11.998          speex  warning: No playback frame available (your application is buggy and/or got xruns)
11:58:12.106   Master/sound  224 samples reduced, buf_cnt=2233
11:58:12.106     alsa_dev.c  ca_thread_func: overrun!
11:58:12.115          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.328   Master/sound !295 samples reduced, buf_cnt=1938
11:58:12.329   Master/sound  Buffer size adjusted from 2233 to 1938 (eff_cnt=1280)
11:58:12.329     alsa_dev.c  ca_thread_func: overrun!
11:58:12.564   Master/sound  31 samples reduced, buf_cnt=2227
11:58:12.565     alsa_dev.c  ca_thread_func: overrun!
11:58:12.573          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:12.574     alsa_dev.c  pb_thread_func: underrun!
11:58:12.803   Master/sound !368 samples reduced, buf_cnt=1859
11:58:12.804   Master/sound  Buffer size adjusted from 2227 to 1859 (eff_cnt=1280)
11:58:12.804     alsa_dev.c  ca_thread_func: overrun!
11:58:12.990     alsa_dev.c  ca_thread_func: overrun!
11:58:13.002          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.223   Master/sound !568 samples reduced, buf_cnt=1931
11:58:13.223     alsa_dev.c  ca_thread_func: overrun!
11:58:13.469   Master/sound  416 samples reduced, buf_cnt=1515
11:58:13.469   Master/sound  Buffer size adjusted from 1931 to 1515 (eff_cnt=1280)
11:58:13.470     alsa_dev.c  ca_thread_func: overrun!
11:58:13.474          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.658     alsa_dev.c !ca_thread_func: overrun!
11:58:13.826     alsa_dev.c  ca_thread_func: overrun!
11:58:13.833          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:13.834     alsa_dev.c  pb_thread_func: underrun!
11:58:14.041   Master/sound !450 samples reduced, buf_cnt=1385
11:58:14.041   Master/sound  Buffer size adjusted from 1835 to 1385 (eff_cnt=1280)
11:58:14.041     alsa_dev.c  ca_thread_func: overrun!
11:58:14.216     alsa_dev.c  ca_thread_func: overrun!
11:58:14.223          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.433   Master/sound !169 samples reduced, buf_cnt=1536
11:58:14.434   Master/sound  Buffer size adjusted from 1705 to 1536 (eff_cnt=1280)
11:58:14.434     alsa_dev.c  ca_thread_func: overrun!
11:58:14.606     alsa_dev.c  ca_thread_func: overrun!
11:58:14.613          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:14.843   Master/sound !459 samples reduced, buf_cnt=1397
11:58:14.843   Master/sound  Buffer size adjusted from 1856 to 1397 (eff_cnt=1280)
11:58:14.844     alsa_dev.c  ca_thread_func: overrun!
11:58:15.023     alsa_dev.c  ca_thread_func: overrun!
11:58:15.032          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.033     alsa_dev.c  pb_thread_func: underrun!
11:58:15.254   Master/sound !454 samples reduced, buf_cnt=1263
11:58:15.254   Master/sound  Buffer size adjusted from 1717 to 1263 (eff_cnt=1280)
11:58:15.254     alsa_dev.c  ca_thread_func: overrun!
11:58:15.448     alsa_dev.c  ca_thread_func: overrun!
11:58:15.455          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:15.636     alsa_dev.c !ca_thread_func: overrun!
11:58:15.808     alsa_dev.c  ca_thread_func: overrun!
11:58:15.814          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.029   Master/sound !300 samples reduced, buf_cnt=1603
11:58:16.030   Master/sound  Buffer size adjusted from 1903 to 1603 (eff_cnt=1280)
11:58:16.030     alsa_dev.c  ca_thread_func: overrun!
11:58:16.195     alsa_dev.c  ca_thread_func: overrun!
11:58:16.204          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.205     alsa_dev.c  pb_thread_func: underrun!
11:58:16.429   Master/sound !369 samples reduced, buf_cnt=1554
11:58:16.430   Master/sound  Buffer size adjusted from 1923 to 1554 (eff_cnt=1280)
11:58:16.430     alsa_dev.c  ca_thread_func: overrun!
11:58:16.609     alsa_dev.c  ca_thread_func: overrun!
11:58:16.617          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:16.851   Master/sound !399 samples reduced, buf_cnt=1475
11:58:16.851   Master/sound  Buffer size adjusted from 1874 to 1475 (eff_cnt=1280)
11:58:16.852     alsa_dev.c  ca_thread_func: overrun!
11:58:17.037     alsa_dev.c  ca_thread_func: overrun!
11:58:17.047          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.268   Master/sound !461 samples reduced, buf_cnt=1334
11:58:17.268   Master/sound  Buffer size adjusted from 1795 to 1334 (eff_cnt=1280)
11:58:17.269     alsa_dev.c  ca_thread_func: overrun!
11:58:17.460     alsa_dev.c  ca_thread_func: overrun!
11:58:17.469          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:17.470     alsa_dev.c  pb_thread_func: underrun!
11:58:17.681   Master/sound !215 samples reduced, buf_cnt=1439
11:58:17.681   Master/sound  Buffer size adjusted from 1654 to 1439 (eff_cnt=1280)
11:58:17.682     alsa_dev.c  ca_thread_func: overrun!
11:58:17.859     alsa_dev.c  ca_thread_func: overrun!
11:58:17.867          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.089   Master/sound !350 samples reduced, buf_cnt=1409
11:58:18.089   Master/sound  Buffer size adjusted from 1759 to 1409 (eff_cnt=1280)
11:58:18.089     alsa_dev.c  ca_thread_func: overrun!
11:58:18.274     alsa_dev.c  ca_thread_func: overrun!
11:58:18.284          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.511   Master/sound !254 samples reduced, buf_cnt=1475
11:58:18.511   Master/sound  Buffer size adjusted from 1729 to 1475 (eff_cnt=1280)
11:58:18.512     alsa_dev.c  ca_thread_func: overrun!
11:58:18.514    pjsua_acc.c !Sending 2 bytes keep-alive packet for acc 1 to 211.149.184.241:5060
11:58:18.515   tdta0xe088f8  Destroying txdata raw
11:58:18.689     alsa_dev.c !ca_thread_func: overrun!
11:58:18.701          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:18.881     alsa_dev.c !ca_thread_func: overrun!
11:58:18.888     alsa_dev.c !pb_thread_func: underrun!
11:58:19.105   Master/sound !283 samples reduced, buf_cnt=1832
11:58:19.105   Master/sound  Buffer size adjusted from 2115 to 1832 (eff_cnt=1280)
11:58:19.105     alsa_dev.c  ca_thread_func: overrun!
11:58:19.114          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.342   Master/sound !414 samples reduced, buf_cnt=1418
11:58:19.343   Master/sound  Buffer size adjusted from 1832 to 1418 (eff_cnt=1280)
11:58:19.343     alsa_dev.c  ca_thread_func: overrun!
11:58:19.517     alsa_dev.c  ca_thread_func: overrun!
11:58:19.526          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.736   Master/sound !173 samples reduced, buf_cnt=1565
11:58:19.736   Master/sound  Buffer size adjusted from 1738 to 1565 (eff_cnt=1280)
11:58:19.736     alsa_dev.c  ca_thread_func: overrun!
11:58:19.924     alsa_dev.c  ca_thread_func: overrun!
11:58:19.935          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:19.936     alsa_dev.c  pb_thread_func: underrun!
11:58:20.115     alsa_dev.c !ca_thread_func: overrun!
11:58:20.132   strm0xe038dc !VAD re-enabled
11:58:20.331   Master/sound !460 samples reduced, buf_cnt=1745
11:58:20.337   Master/sound  Buffer size adjusted from 2205 to 1745 (eff_cnt=1280)
11:58:20.337     alsa_dev.c  ca_thread_func: overrun!
11:58:20.339   strm0xe038dc !Starting silence
11:58:20.340          speex  warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.574   Master/sound !387 samples reduced, buf_cnt=1358
11:58:20.574   Master/sound  Buffer size adjusted from 1745 to 1358 (eff_cnt=1280)
11:58:20.574     alsa_dev.c  ca_thread_func: overrun!
11:58:20.760     alsa_dev.c  ca_thread_func: overrun!
11:58:20.762    tsx0xdf545c !Timeout timer event
11:58:20.762    tsx0xdf545c  .State changed from Completed to Terminated, event=TIMER
11:58:20.765    tsx0xdf545c  Timeout timer event
11:58:20.765    tsx0xdf545c  .State changed from Terminated to Destroyed, event=TIMER
11:58:20.766   tdta0xdf43f0  ..Destroying txdata Response msg 200/NOTIFY/cseq=102 (tdta0xdf43f0)
11:58:20.766    tsx0xdf545c  Transaction destroyed!
11:58:20.948     alsa_dev.c !ca_thread_func: overrun!
11:58:20.958          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:20.960     alsa_dev.c  pb_thread_func: underrun!
11:58:21.187   Master/sound !295 samples reduced, buf_cnt=1383
11:58:21.187   Master/sound  Buffer size adjusted from 1678 to 1383 (eff_cnt=1280)
11:58:21.187     alsa_dev.c  ca_thread_func: overrun!
11:58:21.378     alsa_dev.c  ca_thread_func: overrun!
11:58:21.387          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:21.610   Master/sound !419 samples reduced, buf_cnt=1284
11:58:21.610   Master/sound  Buffer size adjusted from 1703 to 1284 (eff_cnt=1280)
11:58:21.612     alsa_dev.c  ca_thread_func: overrun!
11:58:21.804     alsa_dev.c  ca_thread_func: overrun!
11:58:21.810          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.040   Master/sound !168 samples reduced, buf_cnt=1436
11:58:22.040   Master/sound  Buffer size adjusted from 1604 to 1436 (eff_cnt=1280)
11:58:22.040     alsa_dev.c  ca_thread_func: overrun!
11:58:22.053     alsa_dev.c !pb_thread_func: underrun!
11:58:22.230     alsa_dev.c !ca_thread_func: overrun!
11:58:22.414          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:22.440     alsa_dev.c !ca_thread_func: overrun!
11:58:22.619     alsa_dev.c  ca_thread_func: overrun!
11:58:22.805     alsa_dev.c  ca_thread_func: overrun!
11:58:22.815     alsa_dev.c !pb_thread_func: underrun!
11:58:23.039   Master/sound !232 samples reduced, buf_cnt=1524
11:58:23.039   Master/sound  Buffer size adjusted from 1756 to 1524 (eff_cnt=1280)
11:58:23.039     alsa_dev.c  ca_thread_func: overrun!
11:58:23.229     alsa_dev.c  ca_thread_func: overrun!
11:58:23.237          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.470   Master/sound !341 samples reduced, buf_cnt=1503
11:58:23.470   Master/sound  Buffer size adjusted from 1844 to 1503 (eff_cnt=1280)
11:58:23.471     alsa_dev.c  ca_thread_func: overrun!
11:58:23.645     alsa_dev.c  ca_thread_func: overrun!
11:58:23.652          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:23.860   Master/sound !167 samples reduced, buf_cnt=1656
11:58:23.861   Master/sound  Buffer size adjusted from 1823 to 1656 (eff_cnt=1280)
11:58:23.861     alsa_dev.c  ca_thread_func: overrun!
11:58:24.049     alsa_dev.c  ca_thread_func: overrun!
11:58:24.056          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.057     alsa_dev.c  pb_thread_func: underrun!
11:58:24.267   Master/sound !166 samples reduced, buf_cnt=1810
11:58:24.267   Master/sound  Buffer size adjusted from 1976 to 1810 (eff_cnt=1280)
11:58:24.268     alsa_dev.c  ca_thread_func: overrun!
11:58:24.505   Master/sound  450 samples reduced, buf_cnt=1360
11:58:24.505   Master/sound  Buffer size adjusted from 1810 to 1360 (eff_cnt=1280)
11:58:24.505     alsa_dev.c  ca_thread_func: overrun!
11:58:24.697     alsa_dev.c  ca_thread_func: overrun!
11:58:24.708          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:24.883     alsa_dev.c !ca_thread_func: overrun!
11:58:25.121   Master/sound  209 samples reduced, buf_cnt=1791
11:58:25.121   Master/sound  Buffer size adjusted from 2000 to 1791 (eff_cnt=1280)
11:58:25.122     alsa_dev.c  ca_thread_func: overrun!
11:58:25.132          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.133     alsa_dev.c  pb_thread_func: underrun!
11:58:25.354   Master/sound !319 samples reduced, buf_cnt=1472
11:58:25.354   Master/sound  Buffer size adjusted from 1791 to 1472 (eff_cnt=1280)
11:58:25.354     alsa_dev.c  ca_thread_func: overrun!
11:58:25.547     alsa_dev.c  ca_thread_func: overrun!
11:58:25.557          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:25.790   Master/sound !320 samples reduced, buf_cnt=1472
11:58:25.791   Master/sound  Buffer size adjusted from 1792 to 1472 (eff_cnt=1280)
11:58:25.791     alsa_dev.c  ca_thread_func: overrun!
11:58:25.982     alsa_dev.c  ca_thread_func: overrun!
11:58:25.990          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.218   Master/sound !201 samples reduced, buf_cnt=1591
11:58:26.218   Master/sound  Buffer size adjusted from 1792 to 1591 (eff_cnt=1280)
11:58:26.218     alsa_dev.c  ca_thread_func: overrun!
11:58:26.419          speex !warning: Auto-filling the buffer (your application is buggy and/or got xruns)
11:58:26.422     alsa_dev.c !ca_thread_func: overrun!
11:58:26.424     alsa_dev.c !pb_thread_func: underrun!
11:58:26.643   Master/sound !275 samples reduced, buf_cnt=1636
11:58:26.644   Master/sound  Buffer size adjusted from 1911 to 1636 (eff_cnt=1280)
11:58:26.644     alsa_dev.c  ca_thread_func: overrun!
11:58:26.646 sip_endpoint.c !Processing incoming message: Request msg INVITE/cseq=104 (rdata0xdb3ecc)
11:58:26.646   pjsua_core.c  .RX 841 bytes Request msg INVITE/cseq=104 (rdata0xdb3ecc) from UDP 211.149.184.241:5060:
INVITE sip:192.168.199.246:30003 SIP/2.0
Via: SIP/2.0/UDP 211.149.184.241:5060;branch=z9hG4bK0ed27c3d;rport
Max-Forwards: 70
From: <sip:103009844960152@211.149.184.241>;tag=as47643774
To: <sip:8002@192.168.199.246:30003;ob>;tag=d7d7f583-6390-4a16-9b9c-2f35c8bef97f
Contact: <sip:103009844960152@211.149.184.241:5060>
Call-ID: 356bbaf75eabf6633e02135d7019b2e8@211.149.184.241:5060
CSeq: 104 INVITE
User-Agent: Asterisk PBX 11.7.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 238

Source: (StackOverflow)

Linux: Extract the first line of a file

I am working with OpenWrt and a very small amount of space.

Trying to extract the first line from a file. The line needs to go into a variable and be removed from the file. I can use head to put it into a variable but can't use tail because as far as I understand I would have to do tail file > newFile and I do not have room for that second file.

Does some one know if a better technic?


Source: (StackOverflow)

Advertisements

cross-compiled Valgrind does not detect obvious leaks

I cross compiled Valgrind to openwrt x86 platform. It doesn't detect any leaks when running on target. On Ubuntu, it works fine.

My test program is simple

main()
{
   char *p = malloc(10000);

   *(p-1) = 1;
}

Relevant compilation steps

i486-openwrt-linux-uclibc-gcc -c -o leak.o -pipe -march=i486 -fhonour-copts  -I/home/r2/external/openwrt/staging_dir/target-i386_uClibc-0.9.30.1/usr/include -I/home/r2/external/openwrt/staging_dir/target-i386_uClibc-0.9.30.1/include -I/home/r2/external/openwrt/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/include  -O0 -g -I. -Idbus -I/home/r2/external/openwrt/staging_dir/target-i386_uClibc-0.9.30.1/usr/include leak.c
leak.c: In function 'main':
leak.c:3: warning: incompatible implicit declaration of built-in function 'malloc'
  CC  leak.c
i486-openwrt-linux-uclibc-gcc leak.o  -L/hom e/r2/external/openwrt/staging_dir/target-i386_uClibc-0.9.30.1/usr/lib -L/home/r2/external/openwrt/staging_dir/target-i386_uClibc-0.9.30.1/lib -L/home/r2/external/openwrt/staging_dir/toolchain-i386_gcc-4.1.2_uClibc-0.9.30.1/lib  -o leak
  LD  leak

It's not statically linked. objdump confirms that

objdump -x build_dir/target-i386_uClibc-0.9.30.1/test/leak  

build_dir/target-i386_uClibc-0.9.30.1/test/leak:     file format elf32-i386
build_dir/target-i386_uClibc-0.9.30.1/test/leak
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x08048340

Program Header:
    PHDR off    0x00000034 vaddr 0x08048034 paddr 0x08048034 align 2**2
         filesz 0x000000c0 memsz 0x000000c0 flags r-x
  INTERP off    0x000000f4 vaddr 0x080480f4 paddr 0x080480f4 align 2**0
         filesz 0x00000014 memsz 0x00000014 flags r--
    LOAD off    0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
         filesz 0x000004ac memsz 0x000004ac flags r-x
    LOAD off    0x000004ac vaddr 0x080494ac paddr 0x080494ac align 2**12
         filesz 0x000000f4 memsz 0x00000110 flags rw-
 DYNAMIC off    0x000004c0 vaddr 0x080494c0 paddr 0x080494c0 align 2**2
         filesz 0x000000b8 memsz 0x000000b8 flags rw-
   STACK off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
         filesz 0x00000000 memsz 0x00000000 flags rw-

Dynamic Section:
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.0
  INIT                 0x080482d4
  FINI                 0x08048490
  HASH                 0x08048108
  STRTAB               0x080481e4
  SYMTAB               0x08048144
  STRSZ                0x0000009c
  SYMENT               0x00000010
  DEBUG                0x00000000
  PLTGOT               0x08049578
  PLTRELSZ             0x00000020
  PLTREL               0x00000011
  JMPREL               0x080482b4
  VERNEED              0x08048294
  VERNEEDNUM           0x00000001
  VERSYM               0x08048280

Version References:
  required from libgcc_s.so.1:
    0x0b792650 0x00 02 GCC_3.0

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .interp       00000014  080480f4  080480f4  000000f4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .hash         0000003c  08048108  08048108  00000108  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynsym       000000a0  08048144  08048144  00000144  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .dynstr       0000009c  080481e4  080481e4  000001e4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .gnu.version  00000014  08048280  08048280  00000280  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .gnu.version_r 00000020  08048294  08048294  00000294  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rel.plt      00000020  080482b4  080482b4  000002b4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .init         0000001c  080482d4  080482d4  000002d4  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  8 .plt          00000050  080482f0  080482f0  000002f0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  9 .text         00000150  08048340  08048340  00000340  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 10 .fini         00000017  08048490  08048490  00000490  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
 11 .eh_frame     00000004  080484a8  080484a8  000004a8  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 .ctors        00000008  080494ac  080494ac  000004ac  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 13 .dtors        00000008  080494b4  080494b4  000004b4  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 14 .jcr          00000004  080494bc  080494bc  000004bc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 15 .dynamic      000000b8  080494c0  080494c0  000004c0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 16 .got.plt      0000001c  08049578  08049578  00000578  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .data         0000000c  08049594  08049594  00000594  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .bss          0000001c  080495a0  080495a0  000005a0  2**2
                  ALLOC
 19 .comment      00000036  00000000  00000000  000005a0  2**0
                  CONTENTS, READONLY
 20 .debug_aranges 00000020  00000000  00000000  000005d6  2**0
                  CONTENTS, READONLY, DEBUGGING
 21 .debug_pubnames 0000001b  00000000  00000000  000005f6  2**0
                  CONTENTS, READONLY, DEBUGGING
 22 .debug_info   000000b1  00000000  00000000  00000611  2**0
                  CONTENTS, READONLY, DEBUGGING
 23 .debug_abbrev 0000004e  00000000  00000000  000006c2  2**0
                  CONTENTS, READONLY, DEBUGGING
 24 .debug_line   00000039  00000000  00000000  00000710  2**0
                  CONTENTS, READONLY, DEBUGGING
 25 .debug_frame  00000058  00000000  00000000  0000074c  2**2
                  CONTENTS, READONLY, DEBUGGING
 26 .debug_loc    00000043  00000000  00000000  000007a4  2**0
                  CONTENTS, READONLY, DEBUGGING
SYMBOL TABLE:
080480f4 l    d  .interp    00000000              .interp
08048108 l    d  .hash  00000000              .hash
08048144 l    d  .dynsym    00000000              .dynsym
080481e4 l    d  .dynstr    00000000              .dynstr
08048280 l    d  .gnu.version   00000000              .gnu.version
08048294 l    d  .gnu.version_r 00000000              .gnu.version_r
080482b4 l    d  .rel.plt   00000000              .rel.plt
080482d4 l    d  .init  00000000              .init
080482f0 l    d  .plt   00000000              .plt
08048340 l    d  .text  00000000              .text
08048490 l    d  .fini  00000000              .fini
080484a8 l    d  .eh_frame  00000000              .eh_frame
080494ac l    d  .ctors 00000000              .ctors
080494b4 l    d  .dtors 00000000              .dtors
080494bc l    d  .jcr   00000000              .jcr
080494c0 l    d  .dynamic   00000000              .dynamic
08049578 l    d  .got.plt   00000000              .got.plt
08049594 l    d  .data  00000000              .data
080495a0 l    d  .bss   00000000              .bss
00000000 l    d  .comment   00000000              .comment
00000000 l    d  .debug_aranges 00000000              .debug_aranges
00000000 l    d  .debug_pubnames    00000000              .debug_pubnames
00000000 l    d  .debug_info    00000000              .debug_info
00000000 l    d  .debug_abbrev  00000000              .debug_abbrev
00000000 l    d  .debug_line    00000000              .debug_line
00000000 l    d  .debug_frame   00000000              .debug_frame
00000000 l    d  .debug_loc 00000000              .debug_loc
00000000 l    df *ABS*  00000000              crtstuff.c
080494ac l     O .ctors 00000000              __CTOR_LIST__
080494b4 l     O .dtors 00000000              __DTOR_LIST__
080484a8 l     O .eh_frame  00000000              __EH_FRAME_BEGIN__
080494bc l     O .jcr   00000000              __JCR_LIST__
080495a0 l     O .bss   00000001              completed.2431
0804959c l     O .data  00000000              p.2429
08048370 l     F .text  00000000              __do_global_dtors_aux
080495a4 l     O .bss   00000018              object.2483
080483d0 l     F .text  00000000              frame_dummy
00000000 l    df *ABS*  00000000              crtstuff.c
080494b0 l     O .ctors 00000000              __CTOR_END__
080494b8 l     O .dtors 00000000              __DTOR_END__
080484a8 l     O .eh_frame  00000000              __FRAME_END__
080494bc l     O .jcr   00000000              __JCR_END__
08048460 l     F .text  00000000              __do_global_ctors_aux
00000000 l    df *ABS*  00000000              initfini.c
00000000 l    df *ABS*  00000000              leak.c
080494c0 l     O .dynamic   00000000              .hidden _DYNAMIC
08049598 l     O .data  00000000              .hidden __dso_handle
08049578 l     O .got.plt   00000000              .hidden _GLOBAL_OFFSET_TABLE_
00000000       F *UND*  00000000              malloc
08048310  w    F *UND*  00000000              __deregister_frame_info_bases@@GCC_3.0
080482d4 g     F .init  00000000              _init
08048340 g     F .text  00000022              _start
00000000       F *UND*  00000000              __uClibc_main
080495a0 g       *ABS*  00000000              __bss_start
08048424 g     F .text  00000033              main
08048330  w    F *UND*  00000000              __register_frame_info_bases@@GCC_3.0
08049594  w      .data  00000000              data_start
08048490 g     F .fini  00000000              _fini
08048364 g     F .text  00000000              .hidden __get_pc_thunk_bx
080495a0 g       *ABS*  00000000              _edata
080495bc g       *ABS*  00000000              _end
08049594 g       .data  00000000              __data_start
00000000  w      *UND*  00000000              _Jv_RegisterClasses

Here is the valgrind output on the target x86 board

valgrind --leak-check=full -v -d -d -d -d  -d ./leak 
--5221:1:debuglog DebugLog system started by Stage 1, level 5 logging requested
--5221:1:launcher no tool requested, defaulting to 'memcheck'
--5221:2:launcher   selecting platform for './leak'
--5221:2:launcher   selecting platform for './leak'
--5221:2:launcher   opened './leak'
--5221:2:launcher   read 4096 bytes from './leak'
--5221:2:launcher   selected platform 'x86-linux'
--5221:1:launcher selected platform 'x86-linux'
--5221:1:launcher launching /usr/lib/valgrind/memcheck-x86-linux
--5221:1:debuglog DebugLog system started by Stage 2 (main), level 5 logging requested
--5221:1:main     Welcome to Valgrind version 3.8.0 debug logging
--5221:1:main     Checking current stack is plausible
--5221:1:main     Checking initial stack was noted
--5221:1:main     Starting the address space manager
--5221:2:aspacem            sp_at_startup = 0x00bfafb800 (supplied)
--5221:2:aspacem                  minAddr = 0x0004000000 (computed)
--5221:2:aspacem                  maxAddr = 0x00bfafafff (computed)
--5221:2:aspacem                   cStart = 0x0004000000 (computed)
--5221:2:aspacem                   vStart = 0x0061d7e000 (computed)
--5221:2:aspacem    suggested_clstack_top = 0x00beafbfff (computed)
--5221:2:aspacem    <<< SHOW_SEGMENTS: Initial layout (5 segments, 0 segnames)
--5221:2:aspacem      0: RSVN 0000000000-0003ffffff     64m ----- SmFixed
--5221:2:aspacem      1:      0004000000-0061d7dfff   1501m
--5221:2:aspacem      2: RSVN 0061d7e000-0061d7efff    4096 ----- SmFixed
--5221:2:aspacem      3:      0061d7f000-00bfafafff   1501m
--5221:2:aspacem      4: RSVN 00bfafb000-00ffffffff   1029m ----- SmFixed
--5221:2:aspacem    >>>
--5221:2:aspacem    Reading /proc/self/maps
--5221:2:aspacem    <<< SHOW_SEGMENTS: With contents of /proc/self/maps (12 segments, 1 segnames)
--5221:2:aspacem    ( 0) /usr/lib/valgrind/memcheck-x86-linux
--5221:2:aspacem      0: RSVN 0000000000-0003ffffff     64m ----- SmFixed
--5221:2:aspacem      1:      0004000000-0037ffffff    832m
--5221:2:aspacem      2: FILE 0038000000-0038288fff 2658304 r-x-- d=0x803 i=33422   o=4096    (0)
--5221:2:aspacem      3: FILE 0038289000-003828afff    8192 rw--- d=0x803 i=33422   o=2658304 (0)
--5221:2:aspacem      4: ANON 003828b000-0038d20fff     10m rw---
--5221:2:aspacem      5:      0038d21000-0061d7dfff    656m
--5221:2:aspacem      6: RSVN 0061d7e000-0061d7efff    4096 ----- SmFixed
--5221:2:aspacem      7:      0061d7f000-00bfae7fff   1501m
--5221:2:aspacem      8: ANON 00bfae8000-00bfafcfff   86016 rw---
--5221:2:aspacem      9: RSVN 00bfafd000-00ffffdfff   1029m ----- SmFixed
--5221:2:aspacem     10: ANON 00ffffe000-00ffffefff    4096 r-x--
--5221:2:aspacem     11: RSVN 00fffff000-00ffffffff    4096 ----- SmFixed
--5221:2:aspacem    >>>
--5221:1:main     Address space manager is running
--5221:1:main     Starting the dynamic memory manager
--5221:1:mallocfr newSuperblock at 0x61D7F000 (pszB 4194288)  owner VALGRIND/tool
--5221:1:mallocfr deferred_reclaimSuperblock at 0x61D7F000 (pszB 4194288)  (prev 0x0) owner VALGRIND/tool
--5221:1:main     Dynamic memory manager is running
--5221:1:main     Initialise m_debuginfo
--5221:1:main     VG_(libdir) = /usr/lib/valgrind
--5221:1:main     Getting launcher's name ...
--5221:1:main     ... /usr/bin/valgrind
--5221:1:main     Get hardware capabilities ...
--5221:1:main     ... arch = X86, hwcaps = x86-sse1-sse2
--5221:1:main     Getting the working directory at startup
--5221:1:main     ... /root
--5221:1:main     Split up command line
--5221:1:main     (early_) Process Valgrind's command line options
--5221:1:main     Create initial image
--5221:1:initimg  Loading client
--5221:1:initimg  Setup client env
--5221:2:initimg    preload_string:
--5221:2:initimg      "/usr/lib/valgrind/vgpreload_core-x86-linux.so:/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so"
--5221:1:initimg  Setup client stack: size will be 16777216
--5221:2:initimg    Client info: initial_IP=0x40008B4 initial_TOC=0x0 brk_base=0x804A000
--5221:2:initimg    Client info: initial_SP=0xBEAFBD80 max_stack_size=16777216
--5221:1:initimg  Setup client data (brk) segment
--5221:1:main     Setup file descriptors
--5221:1:main     Create fake /proc/<pid>/cmdline
--5221:1:main     Initialise the tool part 1 (pre_clo_init)
--5221:1:mallocfr deferred_reclaimSuperblock NULL (prev 0x61D7F000) owner VALGRIND/tool
--5221:1:mallocfr newSuperblock at 0x6217F000 (pszB 1048560)  owner VALGRIND/exectxt
--5221:1:main     Print help and quit, if requested
--5221:1:main     (main_) Process Valgrind's command line options, setup logging
--5221:1:mallocfr newSuperblock at 0x6227F000 (pszB 1048560)  owner VALGRIND/core
--5221:1:main     Print the preamble...
==5221== Memcheck, a memory error detector
==5221== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==5221== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==5221== Command: ./leak
==5221== 
--5221-- Valgrind options:
--5221--    --leak-check=full
--5221--    -v
--5221--    -d
--5221--    -d
--5221--    -d
--5221--    -d
--5221--    -d
--5221-- Contents of /proc/version:
--5221--   Linux version 2.6.32.27 (ramesh@r2) (gcc version 4.1.2) #16 Mon Apr 1 15:37:49 PDT 2013
--5221-- Arch and hwcaps: X86, x86-sse1-sse2
--5221-- Page sizes: currently 4096, max supported 4096
--5221-- Valgrind library directory: /usr/lib/valgrind
--5221:1:main     ...finished the preamble
--5221:1:main     Initialise the tool part 2 (post_clo_init)
--5221:1:main     Initialise TT/TC
--5221:2:transtab   cache: 8 sectors of 27597024 bytes each = 220776192 total
--5221:2:transtab   table: 524168 total entries, max occupancy 340704 (65%)
--5221:1:main     Initialise redirects
--5221:1:mallocfr newSuperblock at 0x623FA000 (pszB 1048560)  owner VALGRIND/dinfo
--5221:1:main     Load initial debug info
--5221-- Reading syms from /root/leak
--5221:1:redir    transfer ownership V -> C of 0x3803d000 .. 0x3803dfff
--5221:1:main     Initialise scheduler (phase 1)
--5221:1:sched    sched_init_phase1
--5221-- Scheduler: using generic scheduler lock implementation.
--5221:1:main     Tell tool about initial permissions
--5221:2:main       tell tool about 0004000000-0004003fff r-x
--5221:2:main       tell tool about 0004004000-0004005fff rw-
--5221:2:main       tell tool about 0008048000-0008048fff r-x
--5221:2:main       tell tool about 0008049000-0008049fff rw-
--5221:2:main       tell tool about 000804a000-000804afff rwx
--5221:2:main       tell tool about 003803d000-003803dfff r-x
--5221:2:main       tell tool about 00beafb000-00beafbfff rwx
--5221:2:main       mark stack inaccessible 00beafb000-00beafbd7f
--5221:1:main     Initialise scheduler (phase 2)
--5221:1:sched    sched_init_phase2: tid_main=1, cls_end=0xbeafbfff, cls_sz=16777216
--5221:1:main     Finalise initial image
--5221:1:main     Initialise signal management
--5221:1:main     Load suppressions
--5221-- Reading suppressions file: /usr/lib/valgrind/default.supp
--5221:2:stacks     register 0xBEAFB000-0xBEAFBFFF as stack 0
--5221:1:main     
--5221:1:main     
--5221:1:aspacem  <<< SHOW_SEGMENTS: Memory layout at client startup (25 segments, 3 segnames)
--5221:1:aspacem  ( 0) /usr/lib/valgrind/memcheck-x86-linux
--5221:1:aspacem  ( 1) /root/leak
--5221:1:aspacem  ( 2) /lib/ld-uClibc-0.9.30.1.so
--5221:1:aspacem    0: RSVN 0000000000-0003ffffff     64m ----- SmFixed
--5221:1:aspacem    1: file 0004000000-0004003fff   16384 r-x-- d=0x803 i=86      o=0       (2)
--5221:1:aspacem    2: file 0004004000-0004005fff    8192 rw--- d=0x803 i=86      o=12288   (2)
--5221:1:aspacem    3:      0004006000-0008047fff     64m
--5221:1:aspacem    4: file 0008048000-0008048fff    4096 r-x-- d=0x803 i=33471   o=0       (1)
--5221:1:aspacem    5: file 0008049000-0008049fff    4096 rw--- d=0x803 i=33471   o=0       (1)
--5221:1:aspacem    6: anon 000804a000-000804afff    4096 rwx--
--5221:1:aspacem    7: RSVN 000804b000-0008849fff 8384512 ----- SmLower
--5221:1:aspacem    8:      000884a000-0037ffffff    759m
--5221:1:aspacem    9: FILE 0038000000-003803cfff  249856 r-x-- d=0x803 i=33422   o=4096    (0)
--5221:1:aspacem   10: file 003803d000-003803dfff    4096 r-x-- d=0x803 i=33422   o=253952  (0)
--5221:1:aspacem   11: FILE 003803e000-0038288fff 2404352 r-x-- d=0x803 i=33422   o=258048  (0)
--5221:1:aspacem   12: FILE 0038289000-003828afff    8192 rw--- d=0x803 i=33422   o=2658304 (0)
--5221:1:aspacem   13: ANON 003828b000-0038d20fff     10m rw---
--5221:1:aspacem   14:      0038d21000-0061d7dfff    656m
--5221:1:aspacem   15: RSVN 0061d7e000-0061d7efff    4096 ----- SmFixed
--5221:1:aspacem   16: ANON 0061d7f000-0062509fff 7909376 rwx--
--5221:1:aspacem   17:      006250a000-00bdafbfff   1461m
--5221:1:aspacem   18: RSVN 00bdafc000-00beafafff     15m ----- SmUpper
--5221:1:aspacem   19: anon 00beafb000-00beafbfff    4096 rwx--
--5221:1:aspacem   20:      00beafc000-00bfae7fff     15m
--5221:1:aspacem   21: ANON 00bfae8000-00bfafcfff   86016 rw---
--5221:1:aspacem   22: RSVN 00bfafd000-00ffffdfff   1029m ----- SmFixed
--5221:1:aspacem   23: ANON 00ffffe000-00ffffefff    4096 r-x--
--5221:1:aspacem   24: RSVN 00fffff000-00ffffffff    4096 ----- SmFixed
--5221:1:aspacem  >>>
--5221:1:main     
--5221:1:main     
--5221:1:main     Running thread 1
--5221:1:syswrap- entering VG_(main_thread_wrapper_NORETURN)
--5221:1:aspacem  allocated thread stack at 0x6250a000 size 1064960
--5221:1:syswrap- run_a_thread_NORETURN(tid=1): pre-thread_wrapper
--5221:1:syswrap- thread_wrapper(tid=1): entry
--5221:1:gdbsrv   entering call_gdbserver init_reason ... pid 5221 tid 1 status VgTs_Runnable sched_jmpbuf_valid 0
--5221:1:gdbsrv   gdbserver_init gdbserver embedded in valgrind: gdbserver protocol box extracted from gdb 6.6
==5221== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-5221-by-root-on-???
==5221== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-5221-by-root-on-???
==5221== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-5221-by-root-on-???
==5221== 
==5221== TO CONTROL THIS PROCESS USING vgdb (which you probably
==5221== don't want to do, unless you know exactly what you're doing,
==5221== or are doing some strange experiment):
==5221==   /usr/lib/valgrind/../../bin/vgdb --pid=5221 ...command...
==5221== 
==5221== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==5221==   /path/to/gdb ./leak
==5221== and then give GDB the following command
==5221==   target remote | /usr/lib/valgrind/../../bin/vgdb --pid=5221
==5221== --pid is optional if only one valgrind process is running
==5221== 
--5221:1:gdbsrv   Opening read side /tmp/vgdb-pipe-from-vgdb-to-5221-by-root-on-???
--5221:1:gdbsrv   result fd 3
--5221:1:gdbsrv   result safe_fd 1019
--5221:1:transtab allocate sector 0
--5221:1:mallocfr newSuperblock at 0x64AE1000 (pszB   65520)  owner VALGRIND/ttaux
--5221:1:mallocfr newSuperblock at 0x64AF1000 (pszB   65520)  owner VALGRIND/errors
--5221:1:signals  extending a stack base 0xbeafb000 down by 4096
--5221:2:stacks     change stack 0 from 0xBEAFB000-0xBEAFBFFF to 0xBEAFA000-0xBEAFBFFF
--5221:1:syswrap- thread_wrapper(tid=1): exit
--5221:1:syswrap- run_a_thread_NORETURN(tid=1): post-thread_wrapper
--5221:1:syswrap- run_a_thread_NORETURN(tid=1): last one standing
--5221:1:main     entering VG_(shutdown_actions_NORETURN)
--5221:1:aspacem  <<< SHOW_SEGMENTS: Memory layout at client shutdown (43 segments, 8 segnames)
--5221:1:aspacem  ( 0) /usr/lib/valgrind/memcheck-x86-linux
--5221:1:aspacem  ( 1) /root/leak
--5221:1:aspacem  ( 2) /lib/ld-uClibc-0.9.30.1.so
--5221:1:aspacem  ( 3) /tmp/vgdb-pipe-shared-mem-vgdb-5221-by-root-on-???
--5221:1:aspacem  ( 4) /usr/lib/valgrind/vgpreload_core-x86-linux.so
--5221:1:aspacem  ( 5) /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so
--5221:1:aspacem  ( 6) /lib/libgcc_s.so.1
--5221:1:aspacem  ( 7) /lib/libuClibc-0.9.30.1.so
--5221:1:aspacem    0: RSVN 0000000000-0003ffffff     64m ----- SmFixed
--5221:1:aspacem    1: file 0004000000-0004003fff   16384 r-xT- d=0x803 i=86      o=0       (2)
--5221:1:aspacem    2: file 0004004000-0004004fff    4096 r---- d=0x803 i=86      o=12288   (2)
--5221:1:aspacem    3: file 0004005000-0004005fff    4096 rw--- d=0x803 i=86      o=16384   (2)
--5221:1:aspacem    4: anon 0004006000-0004006fff    4096 rw---
--5221:1:aspacem    5:      0004007000-0004007fff    4096
--5221:1:aspacem    6: file 0004008000-0004008fff    4096 r-xT- d=0x803 i=33412   o=0       (4)
--5221:1:aspacem    7: file 0004009000-0004009fff    4096 rw--- d=0x803 i=33412   o=0       (4)
--5221:1:aspacem    8: file 000400a000-0004012fff   36864 r-xT- d=0x803 i=33423   o=0       (5)
--5221:1:aspacem    9: file 0004013000-0004013fff    4096 rw--- d=0x803 i=33423   o=32768   (5)
--5221:1:aspacem   10: file 0004014000-000401dfff   40960 r-xT- d=0x803 i=338     o=0       (6)
--5221:1:aspacem   11: file 000401e000-000401efff    4096 rw--- d=0x803 i=338     o=36864   (6)
--5221:1:aspacem   12: file 000401f000-0004064fff  286720 r-xT- d=0x803 i=135     o=0       (7)
--5221:1:aspacem   13: file 0004065000-0004065fff    4096 r---- d=0x803 i=135     o=282624  (7)
--5221:1:aspacem   14: file 0004066000-0004066fff    4096 rw--- d=0x803 i=135     o=286720  (7)
--5221:1:aspacem   15: anon 0004067000-000406bfff   20480 rw---
--5221:1:aspacem   16:      000406c000-0008047fff     63m
--5221:1:aspacem   17: file 0008048000-0008048fff    4096 r-xT- d=0x803 i=33471   o=0       (1)
--5221:1:aspacem   18: file 0008049000-0008049fff    4096 rw--- d=0x803 i=33471   o=0       (1)
--5221:1:aspacem   19: anon 000804a000-000804cfff   12288 rwx--
--5221:1:aspacem   20: RSVN 000804d000-0008849fff 8376320 ----- SmLower
--5221:1:aspacem   21:      000884a000-0037ffffff    759m
--5221:1:aspacem   22: FILE 0038000000-003803cfff  249856 r-x-- d=0x803 i=33422   o=4096    (0)
--5221:1:aspacem   23: file 003803d000-003803dfff    4096 r-x-- d=0x803 i=33422   o=253952  (0)
--5221:1:aspacem   24: FILE 003803e000-0038288fff 2404352 r-x-- d=0x803 i=33422   o=258048  (0)
--5221:1:aspacem   25: FILE 0038289000-003828afff    8192 rw--- d=0x803 i=33422   o=2658304 (0)
--5221:1:aspacem   26: ANON 003828b000-0038d20fff     10m rw---
--5221:1:aspacem   27:      0038d21000-0061d7dfff    656m
--5221:1:aspacem   28: RSVN 0061d7e000-0061d7efff    4096 ----- SmFixed
--5221:1:aspacem   29: ANON 0061d7f000-0062509fff 7909376 rwx--
--5221:1:aspacem   30: ANON 006250a000-006250bfff    8192 -----
--5221:1:aspacem   31: ANON 006250c000-006260bfff 1048576 rwx--
--5221:1:aspacem   32: ANON 006260c000-006260dfff    8192 -----
--5221:1:aspacem   33: FILE 006260e000-006260efff    4096 rw--- d=0x00b i=8236    o=0       (3)
--5221:1:aspacem   34: ANON 006260f000-0064b08fff     36m rwx--
--5221:1:aspacem   35:      0064b09000-00bdafbfff   1423m
--5221:1:aspacem   36: RSVN 00bdafc000-00beaf9fff     15m ----- SmUpper
--5221:1:aspacem   37: anon 00beafa000-00beafbfff    8192 rwx--
--5221:1:aspacem   38:      00beafc000-00bfae7fff     15m
--5221:1:aspacem   39: ANON 00bfae8000-00bfafcfff   86016 rw---
--5221:1:aspacem   40: RSVN 00bfafd000-00ffffdfff   1029m ----- SmFixed
--5221:1:aspacem   41: ANON 00ffffe000-00ffffefff    4096 r-x--
--5221:1:aspacem   42: RSVN 00fffff000-00ffffffff    4096 ----- SmFixed
--5221:1:aspacem  >>>
==5221== 
==5221== HEAP SUMMARY:
==5221==     in use at exit: 0 bytes in 0 blocks
==5221==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==5221== 
==5221== All heap blocks were freed -- no leaks are possible
==5221== 
==5221== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1)
--5221-- 
--5221-- used_suppression:      1 ld(Cond)
==5221== 
==5221== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1)
--5221:1:gdbsrv   remote_finish (reason orderly_finish) 1019 -1
--5221:1:gdbsrv   unlinking
    /tmp/vgdb-pipe-from-vgdb-to-5221-by-root-on-???
    /tmp/vgdb-pipe-to-vgdb-from-5221-by-root-on-???
    /tmp/vgdb-pipe-shared-mem-vgdb-5221-by-root-on-???
--5221:1:core_os  VG_(terminate_NORETURN)(tid=1)

Source: (StackOverflow)

Automaticly upload to FTPS

How can I upload a file on an OpenWRT router to a place using FTPES?

I googled curl, because it's small enough to install:

opkg update opkg install curl

and can handle FTPES connections: http://curl.haxx.se/docs/comparison-table.html

Ok. But heres the problem: i just can't guess out, how could i upload a file.

Can someone point me to a working, good howto?


Source: (StackOverflow)

Partial compilation of openwrt project

I would like to get an idea or reference to compile only subset on the openwrt project. i am aware of the menuconfig utility but this is not enough for my goal.

i would like to compile only the tool-chain (binutils + gcc + glibc) for a specific target (ar71xx) and also the kernel.

now, after looking in the makefiles etc, i have noticed that most of the work in actually patching the toolchain and the kernel and then compile it. is there any option to stop build process after the patching so i can have only the source code patched and i can write my own make file to compile it?


Source: (StackOverflow)

How to reset luci password from ssh

I have forgotten my luci password, but can get in via ssh. How do I reset the luci password from the console? I see that in /etc/config/luci there is this:

config extern 'flash_keep'
...
        option passwd '/etc/passwd'
...

So is it done with the regular passwd command?


Source: (StackOverflow)

Cross compiling Gnu Radio for Openwrt

I'm attempting to install Gnu Radio on OpenWRT "Attittude Adjustment" (latest trunk sources). I've cross compiled GR and everything seems to have compiled and linked just fine. However, importing the module in Python results in the following:

root@OpenWrt:/usr/lib/python2.7/dist-packages/gnuradio/gr# python
Python 2.7.3 (default, Jul 21 2012, 17:36:54) 
[GCC 4.6.3 20120201 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import gr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/__init__.py", line 43, in <module>
    from gnuradio_core import *
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core.py", line 23, in <module>
    from gnuradio_core_runtime import *
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py", line 26, in <module>
    _gnuradio_core_runtime = swig_import_helper()
  File "/usr/lib/python2.7/dist-packages/gnuradio/gr/gnuradio_core_runtime.py", line 22, in swig_import_helper
    _mod = imp.load_module('_gnuradio_core_runtime', fp, pathname, description)
ImportError: File not found
>>> 

Note that Python has been invoked in the directory containing the SWIG library. Here is ldd _gnuradio_core_runtime.so, running on the target system:

checking sub-depends for '/usr/lib/libgnuradio-core-3.6.2git.so.0.0.0'
checking sub-depends for '/usr/lib/libgruel-3.6.2git.so.0.0.0'
checking sub-depends for '/usr/lib/libboost_date_time.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_program_options.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_filesystem.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_system.so.1.49.0'
checking sub-depends for '/usr/lib/libboost_thread.so.1.49.0'
checking sub-depends for '/lib/libpthread.so.0'
checking sub-depends for '/usr/lib/libstdc++.so.6'
checking sub-depends for '/lib/libm.so.0'
checking sub-depends for '/lib/libgcc_s.so.1'
checking sub-depends for '/lib/libc.so.0'
checking sub-depends for '/usr/lib/libfftw3f.so.3'
checking sub-depends for 'not found'
checking sub-depends for '/lib/librt.so.0'
checking sub-depends for '/usr/lib/libvolk.so.0.0.0'
checking sub-depends for '/lib/libdl.so.0'
    libgnuradio-core-3.6.2git.so.0.0.0 => /usr/lib/libgnuradio-core-3.6.2git.so.0.0.0 (0x00000000)
    libgruel-3.6.2git.so.0.0.0 => /usr/lib/libgruel-3.6.2git.so.0.0.0 (0x00000000)
    libboost_date_time.so.1.49.0 => /usr/lib/libboost_date_time.so.1.49.0 (0x00000000)
    libboost_program_options.so.1.49.0 => /usr/lib/libboost_program_options.so.1.49.0 (0x00000000)
    libboost_filesystem.so.1.49.0 => /usr/lib/libboost_filesystem.so.1.49.0 (0x00000000)
    libboost_system.so.1.49.0 => /usr/lib/libboost_system.so.1.49.0 (0x00000000)
    libboost_thread.so.1.49.0 => /usr/lib/libboost_thread.so.1.49.0 (0x00000000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00000000)
    libm.so.0 => /lib/libm.so.0 (0x00000000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000)
    libc.so.0 => /lib/libc.so.0 (0x00000000)
    libfftw3f.so.3 => /usr/lib/libfftw3f.so.3 (0x00000000)
    libfftw3f_threads.so.3 => not found (0x00000000)
    librt.so.0 => /lib/librt.so.0 (0x00000000)
    libvolk.so.0.0.0 => /usr/lib/libvolk.so.0.0.0 (0x00000000)
    libdl.so.0 => /lib/libdl.so.0 (0x00000000)
    ld-uClibc.so.0 => ld-uClibc.so.0 (0x00000000)

Here is the output of file _gnuradio_core_runtime.so on the build system:

_gnuradio_core_runtime.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped

The target system runs on an Intel Atom. Finally, the last piece of useful information I can think of is that PYTHONPATH is set to /usr/lib/python2.7/dist-packages. I'm at a loss as to what the problem is. I hope the wonderful stack overflow community may help find a solution. Thank you in advance for any pointers!


Source: (StackOverflow)

Java on OpenWrt/DD-WRT

I have an existing solution written in Java which I would love to run on OpenWrt routers. Will OpenWrt even run Java without installing a lot of dependencies? Anyone ever tried this?


Source: (StackOverflow)

How to revert back a openwrt router configuration?

I recently ported luci to openwrt router. I was just exploring the thing. I disabled the DHCP server on LAN and enabled as dhcp client. I saved and applied the configuration to the router. Now after restart I am not able to connect the router webpage.

Can anyone please let me know how to enable the dhcp server again or can anyone let me know how to reset this openwrt router to default settings?

I tried in the serial port console. but I can't see any IP address for any interfaces. Before It was 192.168.1.1.

Please suggest...


Source: (StackOverflow)

openwrt buildroot build_dir and staging_dir

I am confused about build_dir and staging_dir in openwrt buildroot. What are they used for?

There are feeds in openwrt. I would imagine to build an image. You will select the packages you want in menuconfig and use make to build it.

The packages are fetched from feeds and then compiled into build_dir?

Then what is staging_dir used for?


Source: (StackOverflow)

How to know the gcc version used to build the linux?

I use OpenWRT. it's a linux distribution for embedded systems

I want to know the gcc version used to compile the linux

I made some researchs in the net but without results.

I tried to execute these commands for some existing binary in the linux OpenWRT (like wget)

strings -a <default binary> | grep "GCC"
strings -a <default binary> | grep "gcc"

But I did not get any result

even the

strings -a  /lib/libgcc_s.so.1 | grep  "gcc"
strings -a /lib/libuClibc-0.9.30.1.so | grep   "gcc"

does not give any result

Are there a way to know used gcc to build the whole linux (For both user space and kernel space)?


Source: (StackOverflow)

Need to increase buffer for IPC message queue in OpenWRT

I'm just learning how to use message queues, and I am having a little difficulty with them. I am using two completely separate applications to do the testing -- one is the "sender", and the other is the "receiver".

When I run the sender, it sends 15 strings to the pipe, but then afterward fails with a "Resource temporarily unavailable" error. I just need to consume the messages on the receiver side, but why only 15 messages? I might be sending lots of messages, so I'd like to increase this to a much larger number, like 1000 or so.

I tried to set the message queue size to 32767, so I was expecting 31 at least, but apparently msg_qbytes is not related to the number of messages that can be buffered.

The sender code looks like this:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <unistd.h>
#include <string.h>

#define MESSAGE_SIZE 1024

typedef struct msgbuf
{
    long mtype;
    char mtext[MESSAGE_SIZE];
};

int main(int argc, char *argv[]) {
    int msgid;
    int ret;
    struct msqid_ds msg_settings;
    long key;
        struct msgbuf msg;

    key = strtol(argv[1], NULL, 10);
    // print the message queue ID for reading via msgrcv
    printf( "Getting message queue with key = %ld\n", key);
    usleep( 1000000);

    msgid = msgget( (key_t)key, 0666 | IPC_CREAT);

    if (msgid == -1) {
        perror("msgget failed with error");
        exit(EXIT_FAILURE);
    }

    // read in current queue settings and then set the new
    // queue size.
    ret = msgctl(msgid, IPC_STAT, &msg_settings);
    msg_settings.msg_qbytes = 32767;
    msgctl( msgid, IPC_SET, &msg_settings);

    while( 1) {
        msg.mtype = 1; // we'll always leave this as 1
        memset( &(msg.mtext), 0, MESSAGE_SIZE);
        sprintf( msg.mtext, "hi");
        printf( "Sending data: %s\n", msg.mtext);
        ret = msgsnd( 1, &msg, MESSAGE_SIZE, IPC_NOWAIT);
        usleep( 500000);
        if( ret == -1) {
            perror( "msgsnd failed\n");
    }

    printf( "leaving...\n");

    return EXIT_SUCCESS;
}

The receiver code looks like this:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

#define MESSAGE_SIZE 1024

typedef struct msgbuf
{
    long mtype;
    char mtext[MESSAGE_SIZE];
};

int main(int argc, char *argv[]) {
    long int msgtyp = 1;
    int ret;
    size_t msgsz;
    struct msgbuf mymsg;

    int msgid;
    msgid = strtol(argv[1], NULL, 10);
    printf( "Reading message queue with ID = %d\n", msgid);
    usleep( 1000000);
    while( 1) {
        msgsz = (size_t)MESSAGE_SIZE;
        ret = msgrcv( msgid, &mymsg, msgsz, msgtyp, IPC_NOWAIT);
        if( ret == ENOMSG) {
            usleep( 100000);
            continue;
        }

        if( ret == -1) {
            perror( "msgrcv failed");
        } else {
            printf( "Read data: %s", mymsg.mtext);
            }

        usleep( 100000);
    }
    return EXIT_SUCCESS;
}

Source: (StackOverflow)

What does "@" mean in a C/C++'s macro?

I cross-compiled a firmware with openwrt, and a file is strange named libbfd.h and I compiling failed, I have ever seen it. In libbfd.h line 83:

79 #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
80 #define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@
81 #if @BFD_HOST_64_BIT_DEFINED@
82 #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
83 #define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
84 typedef BFD_HOST_64_BIT bfd_int64_t;
85 typedef BFD_HOST_U_64_BIT bfd_uint64_t;
86 #endif

here BFD_HOST_U_64_BIT is defined as @BFD_HOST_64_BIT@, what's mean with "@", I tested in a test file, can't compiling. Could anybody help me? Thx!


Source: (StackOverflow)

Busybox awk: How to treat each character in String as integer to perform bitwise operations?

I wanna change SSID wifi network name dynamically in OpenWRT via script which grab information from internet.

Because the information grabbed from internet may contains multiple-bytes characters, so it's can be easily truncated to invalid UTF-8 bytes sequence, so I want to use awk (busybox) to fix it. However, when I try to use bitwise function and on a String and integer, the result always return 0.

awk 'BEGIN{v="a"; print and(v,0xC0)}'

How to treat character in String as integer in awk like we can do in C/C++? char p[]="abc"; printf ("%d",*(p+1) & 0xC0);


Source: (StackOverflow)

How to auto start an application in openwrt?

I have created a shell with necessary functions such as start() stop() restart()

But my file is not getting started at boot time.

I have used update-rc.d command in "ubuntu" to add this file to the list of autostart applications. And it was successfully started at boot time.

But in "openwrt" I have seen an enable function. Anyone aware of how to use this enable function or is there any similar command like update-rc.d in "openwrt"

I had some reference here : http://wiki.openwrt.org/doc/techref/initscripts


Source: (StackOverflow)