* [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h>
@ 2017-09-19 23:27 Sandeep Patil
2017-10-11 12:15 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Sandeep Patil @ 2017-09-19 23:27 UTC (permalink / raw)
To: ltp
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.
Signed-off-by: Sandeep Patil <sspatil@google.com>
---
testcases/kernel/io/direct_io/diotest4.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/testcases/kernel/io/direct_io/diotest4.c b/testcases/kernel/io/direct_io/diotest4.c
index f3b7d3ba8..a9ecff00f 100644
--- a/testcases/kernel/io/direct_io/diotest4.c
+++ b/testcases/kernel/io/direct_io/diotest4.c
@@ -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;
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h>
2017-09-19 23:27 [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h> Sandeep Patil
@ 2017-10-11 12:15 ` Cyril Hrubis
2017-10-18 5:49 ` Sandeep Patil
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-10-11 12:15 UTC (permalink / raw)
To: ltp
Hi!
> 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 <deller@gmx.de>
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.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread* [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h>
2017-10-11 12:15 ` Cyril Hrubis
@ 2017-10-18 5:49 ` Sandeep Patil
2017-10-26 8:16 ` Cyril Hrubis
0 siblings, 1 reply; 5+ messages in thread
From: Sandeep Patil @ 2017-10-18 5:49 UTC (permalink / raw)
To: ltp
On Wed, Oct 11, 2017 at 02:15:06PM +0200, Cyril Hrubis wrote:
> Hi!
> > 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 <deller@gmx.de>
> 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.
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h>
2017-10-18 5:49 ` Sandeep Patil
@ 2017-10-26 8:16 ` Cyril Hrubis
2017-11-06 18:37 ` Sandeep Patil
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2017-10-26 8:16 UTC (permalink / raw)
To: ltp
Hi!
> 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?
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 5+ messages in thread
* [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h>
2017-10-26 8:16 ` Cyril Hrubis
@ 2017-11-06 18:37 ` Sandeep Patil
0 siblings, 0 replies; 5+ messages in thread
From: Sandeep Patil @ 2017-11-06 18:37 UTC (permalink / raw)
To: ltp
On Thu, Oct 26, 2017 at 1:16 AM, Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > 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?
>
>
Ah, that sounds even better. Amending my patch to make it that
way now.
- ssp
> --
> Cyril Hrubis
> chrubis@suse.cz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20171106/71bf63dd/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-11-06 18:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19 23:27 [LTP] [PATCH] android: io/diotest4: remove dependency on <sys/shm.h> Sandeep Patil
2017-10-11 12:15 ` Cyril Hrubis
2017-10-18 5:49 ` Sandeep Patil
2017-10-26 8:16 ` Cyril Hrubis
2017-11-06 18:37 ` Sandeep Patil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox