aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/proc/proc-self-map-files-002.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/proc/proc-self-map-files-002.c')
-rw-r--r--tools/testing/selftests/proc/proc-self-map-files-002.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/testing/selftests/proc/proc-self-map-files-002.c b/tools/testing/selftests/proc/proc-self-map-files-002.c
index 6f1f4a6e1ecb..85744425b08d 100644
--- a/tools/testing/selftests/proc/proc-self-map-files-002.c
+++ b/tools/testing/selftests/proc/proc-self-map-files-002.c
@@ -13,7 +13,7 @@
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16/* Test readlink /proc/self/map_files/... with address 0. */ 16/* Test readlink /proc/self/map_files/... with minimum address. */
17#include <errno.h> 17#include <errno.h>
18#include <sys/types.h> 18#include <sys/types.h>
19#include <sys/stat.h> 19#include <sys/stat.h>
@@ -47,6 +47,11 @@ static void fail(const char *fmt, unsigned long a, unsigned long b)
47int main(void) 47int main(void)
48{ 48{
49 const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); 49 const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE);
50#ifdef __arm__
51 unsigned long va = 2 * PAGE_SIZE;
52#else
53 unsigned long va = 0;
54#endif
50 void *p; 55 void *p;
51 int fd; 56 int fd;
52 unsigned long a, b; 57 unsigned long a, b;
@@ -55,7 +60,7 @@ int main(void)
55 if (fd == -1) 60 if (fd == -1)
56 return 1; 61 return 1;
57 62
58 p = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); 63 p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0);
59 if (p == MAP_FAILED) { 64 if (p == MAP_FAILED) {
60 if (errno == EPERM) 65 if (errno == EPERM)
61 return 2; 66 return 2;