Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bmah888 opened this issue Feb 28, 2014 · 8 comments
Closed

Comments

@bmah888
Copy link
Contributor

bmah888 commented Feb 28, 2014

From frode.isaksen on November 27, 2013 07:11:25

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.

Attachment: android-fix.diff

Original issue: http://code.google.com/p/iperf/issues/detail?id=116

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From jef.poskanzer on December 13, 2013 08:43:40

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.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From jef.poskanzer on December 13, 2013 08:47:20

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.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From frode.isaksen on December 13, 2013 08:54:37

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.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From jef.poskanzer on December 13, 2013 09:36:37

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.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From frode.isaksen on December 17, 2013 05:13:29

OK - if using /tmp fails, I will try using /cache. Is this OK or ??

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From bltierney@es.net on December 18, 2013 13:43:43

Labels: Milestone-3.1a1

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From frode.isaksen on January 17, 2014 01:07:59

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.

Attachment: android-fix2.diff

@bmah888
Copy link
Contributor Author

bmah888 commented Jun 8, 2017

As a part of #517, iperf3 (as of about 3.2) now honors the $TMPDIR environment variable, so I think that should solve this problem. (This was also mentioned in pull request #313). Closing this issue.

@bmah888 bmah888 closed this as completed Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants