android: io/diotest4: remove dependency on <sys/shm.h>
PATCH 1/1 android: io/diotest4: remove dependency on <sys/shm.h>
The dependency causes the test to fail build when being compiled against bionic. The code however only seem to need that header for 'SHMLBA' constant used to set the mmap'ed segment size. That is replaced by the page size with this change. Tested on both Android device and a x86 workstation successfully.
---
testcases/kernel/io/direct_io/diotest4.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/io/direct_io/diotest4.c +1 -2
@@ -65,7 +65,6 @@#include <sys/mman.h> #include <sys/syscall.h> #include <errno.h> -#include <sys/shm.h> #include "diotest_routines.h"
@@ -195,7 +194,7 @@ int main(int argc, char *argv[])int fd, newfd;int i, l_fail =0 , fail_count =0 , total =0 ;int failed =0 ; -int shmsz =SHMLBA ; +int shmsz =sysconf (_SC_PAGE_SIZE);int pagemask = ~(sysconf (_SC_PAGE_SIZE) -1 );char *buf0, *buf1, *buf2;caddr_t shm_base;
Signature · 1 line
2.14.1.690.gbb1197296e-goog
PATCH 1/1 android: io/diotest4: remove dependency on <sys/shm.h>
Hi!
Quoted 5 lines
The dependency causes the test to fail build when being compiled against bionic. The code however only seem to need that header for 'SHMLBA' constant used to set the mmap'ed segment size. That is replaced by the page size with this change. Tested on both Android device and a x86 workstation successfully.
Looking at the test git log it contains reverse of this patch, the getpagesize() was replaced with SHMLBA, unfortunately the commit log does not say why.
Digging up in LTP mailing list pointed to these:
https://sourceforge.net/p/ltp/mailman/ltp-list/?viewmonth=200804
Also see this commit:
commit 512cb343ef35cb952b87405787f2325106b5f48c
Author: Helge Deller <[email protected]> Date: Fri Jun 16 15:55:23 2017 +0200
mmap01: fix testcase on hppa architecture
The mmap() syscall to map a file at any given page-aligned address (via the MAP_FIXED flag) can fail on the hppa architecture due to cache colouring requirements of the architecture.
So this will break on strange architectures such as sparc or hppa because we do MAP_FIXED with unsuitable address.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 android: io/diotest4: remove dependency on <sys/shm.h>
Quoted 24 lines · Cyril Hrubis
Hi!
Quoted 5 lines
The dependency causes the test to fail build when being compiled against bionic. The code however only seem to need that header for 'SHMLBA' constant used to set the mmap'ed segment size. That is replaced by the page size with this change. Tested on both Android device and a x86 workstation successfully.
Looking at the test git log it contains reverse of this patch, the
getpagesize()was replaced with SHMLBA, unfortunately the commit log does not say why.Digging up in LTP mailing list pointed to these:
https://sourceforge.net/p/ltp/mailman/ltp-list/?viewmonth=200804
Also see this commit:
commit
512cb343ef35cb952b87405787f2325106b5f48cAuthor: Helge Deller <[email protected]> Date: Fri Jun 16 15:55:23 2017 +0200mmap01: fix testcase on hppa architecture
Quoted 7 lines
The
mmap()syscall to map a file at any given page-aligned address (via theMAP_FIXEDflag) can fail on the hppa architecture due to cache colouring requirements of the architecture.So this will break on strange architectures such as sparc or hppa because we do
MAP_FIXEDwith unsuitable address.
Thank you very much for the history. I guess I can make this change under __BIONIC__ check (like some of the other tests) and that should work fine ..
- ssp
PATCH 1/1 android: io/diotest4: remove dependency on <sys/shm.h>
Hi!
Quoted 2 lines
Thank you very much for the history. I guess I can make this change under
__BIONIC__check (like some of the other tests) and that should work fine ..
Or we may as well fix this in a clean way and once for all. What about adding a constant to include/lapi/mmap.h something as MMAP_GRANULARITY and defining it to SHMLBA if the shm headers are present and to getpagesize() if they are not?
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 android: io/diotest4: remove dependency on <sys/shm.h>
Quoted 11 lines · Cyril Hrubis
Hi!
Quoted 2 lines
Thank you very much for the history. I guess I can make this change under
__BIONIC__check (like some of the other tests) and that should workfine ..
Or we may as well fix this in a clean way and once for all. What about adding a constant to
include/lapi/mmap.hsomething asMMAP_GRANULARITYand defining it to SHMLBA if the shm headers are present and togetpagesize()if they are not?
Ah, that sounds even better. Amending my patch to make it that way now.
- ssp
Quoted 4 lines
--
Cyril Hrubis
[email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20171106/71bf63dd/attachment.html>