sudonym1 / iperf

Automatically exported from code.google.com/p/iperf
Other
0 stars 0 forks source link

Android cannot create mmap'ed file in /tmp, so only use it if 'zerocopy' set #116

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Android cannot create mmap'ed file in /tmp, so only use it if 'zerocopy' set. 
If not 'zerocopy', use malloc'ed buffer instead of mmap'ed buffer.
Patch attached.

Original issue reported on code.google.com by frode.is...@gmail.com on 27 Nov 2013 at 3:11

Attachments:

GoogleCodeExporter commented 9 years ago
There's some similar code in issue 100's patches.

There's also similar code to be found in old versions of iperf_api.c.  The 
first mmap version was 324, so this will get you the final malloc version:
  hg cat -r 323 src/iperf_api.c
It does at least one thing this patch does not: page-align the buffer. So that 
idea should be combined with the patch's conditional mmap/malloc.

Original comment by jef.posk...@gmail.com on 13 Dec 2013 at 4:43

GoogleCodeExporter commented 9 years ago
Actually, on second glance what the patch in issue 100 does is use /cache 
instead of /tmp on Android. If that makes it possible to continue using mmap in 
all cases then that is the simpler change and we don't need to resurrect the 
malloc code.

Original comment by jef.posk...@gmail.com on 13 Dec 2013 at 4:47

GoogleCodeExporter commented 9 years ago
We would like to use a single binary for both Android and Linux, so having a 
conditional compile flag for Android is not that good..
What about passing the location for the mmap'ed buffer as a parameter (while 
keeping /tmp as default) ?
Also, I can rework the patch to page-align the buffer if you want.

Original comment by frode.is...@gmail.com on 13 Dec 2013 at 4:54

GoogleCodeExporter commented 9 years ago
Not needing to build a separate Android binary is a good goal, but --zerocopy 
functioning on Android is even better.

Maybe there's some way to do a runtime test of whether to use /tmp or /cache.

Original comment by jef.posk...@gmail.com on 13 Dec 2013 at 5:36

GoogleCodeExporter commented 9 years ago
OK - if using /tmp fails, I will try using /cache. Is this OK or ??

Original comment by frode.is...@gmail.com on 17 Dec 2013 at 1:13

GoogleCodeExporter commented 9 years ago

Original comment by bltier...@es.net on 18 Dec 2013 at 9:43

GoogleCodeExporter commented 9 years ago
Included you will find a patch that will try different locations for the 
temporary mmap'ed file. I have added /cache for Android, but you can easily add 
other locations as well.

Original comment by frode.is...@gmail.com on 17 Jan 2014 at 9:07

Attachments:

GoogleCodeExporter commented 9 years ago
I use attached patch code to allow application defined directory at run time.  
For my case is an iOS app. 

Original comment by alvinc...@gmail.com on 12 Mar 2014 at 6:45

Attachments: