From e7eeb38d23b990c5d64ad395cddad0b091f29f90 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 29 Jul 2016 15:28:49 -0400 Subject: posix: move sys/mman.h to newlib and test it in psxhdrs --- testsuites/psxtests/psxhdrs/Makefile.am | 13 ++++++++++ testsuites/psxtests/psxhdrs/sys/mman/mlock.c | 28 ++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/mlockall.c | 27 +++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/mmap.c | 30 ++++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/mprotect.c | 29 +++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/msync.c | 29 +++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/munlock.c | 28 ++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/munlockall.c | 25 ++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/munmap.c | 28 ++++++++++++++++++++ .../psxtests/psxhdrs/sys/mman/posix_madvise.c | 29 +++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/shm_open.c | 29 +++++++++++++++++++++ testsuites/psxtests/psxhdrs/sys/mman/shm_unlink.c | 27 +++++++++++++++++++ 12 files changed, 322 insertions(+) create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/mlock.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/mlockall.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/mmap.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/mprotect.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/msync.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/munlock.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/munlockall.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/munmap.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/posix_madvise.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/shm_open.c create mode 100644 testsuites/psxtests/psxhdrs/sys/mman/shm_unlink.c (limited to 'testsuites/psxtests') diff --git a/testsuites/psxtests/psxhdrs/Makefile.am b/testsuites/psxtests/psxhdrs/Makefile.am index e902500b9d..a987bf0639 100644 --- a/testsuites/psxtests/psxhdrs/Makefile.am +++ b/testsuites/psxtests/psxhdrs/Makefile.am @@ -141,6 +141,19 @@ lib_a_SOURCES += unistd/sync.c lib_a_SOURCES += unistd/ualarm.c lib_a_SOURCES += unistd/usleep.c +# methods in +lib_a_SOURCES += sys/mman/mlockall.c +lib_a_SOURCES += sys/mman/mlock.c +lib_a_SOURCES += sys/mman/mmap.c +lib_a_SOURCES += sys/mman/mprotect.c +lib_a_SOURCES += sys/mman/msync.c +lib_a_SOURCES += sys/mman/munlockall.c +lib_a_SOURCES += sys/mman/munlock.c +lib_a_SOURCES += sys/mman/munmap.c +lib_a_SOURCES += sys/mman/posix_madvise.c +lib_a_SOURCES += sys/mman/shm_open.c +lib_a_SOURCES += sys/mman/shm_unlink.c + if HAS_NETWORKING # methods in lib_a_SOURCES += sys/socket/accept.c diff --git a/testsuites/psxtests/psxhdrs/sys/mman/mlock.c b/testsuites/psxtests/psxhdrs/sys/mman/mlock.c new file mode 100644 index 0000000000..1f7d7b5aee --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/mlock.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + + return mlock( addr, len ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/mlockall.c b/testsuites/psxtests/psxhdrs/sys/mman/mlockall.c new file mode 100644 index 0000000000..023c0a40ba --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/mlockall.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + int flags = 0; + + return mlockall( flags ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/mmap.c b/testsuites/psxtests/psxhdrs/sys/mman/mmap.c new file mode 100644 index 0000000000..761320042a --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/mmap.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +void* test( void ); + +void* test( void ) +{ + void *addr = NULL; + size_t len = 0; + int prot = 0, flags = 0, fildes = 0; + off_t off = 0; + + return mmap( addr, len, prot, flags, fildes, off ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/mprotect.c b/testsuites/psxtests/psxhdrs/sys/mman/mprotect.c new file mode 100644 index 0000000000..8b6f423729 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/mprotect.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + int prot = 0; + + return mprotect( addr, len, prot ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/msync.c b/testsuites/psxtests/psxhdrs/sys/mman/msync.c new file mode 100644 index 0000000000..c22f145ff2 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/msync.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + int flags = 0; + + return msync( addr, len, flags ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/munlock.c b/testsuites/psxtests/psxhdrs/sys/mman/munlock.c new file mode 100644 index 0000000000..df901e1183 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/munlock.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + + return munlock( addr, len ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/munlockall.c b/testsuites/psxtests/psxhdrs/sys/mman/munlockall.c new file mode 100644 index 0000000000..2f88ae5b61 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/munlockall.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + return munlockall(); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/munmap.c b/testsuites/psxtests/psxhdrs/sys/mman/munmap.c new file mode 100644 index 0000000000..253230a1ac --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/munmap.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + + return munmap( addr, len ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/posix_madvise.c b/testsuites/psxtests/psxhdrs/sys/mman/posix_madvise.c new file mode 100644 index 0000000000..59b7d1a043 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/posix_madvise.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + void *addr = NULL; + size_t len = 0; + int advice = 0; + + return posix_madvise( addr, len, advice ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/shm_open.c b/testsuites/psxtests/psxhdrs/sys/mman/shm_open.c new file mode 100644 index 0000000000..8db76102cc --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/shm_open.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + char *name = "test"; + int oflag = 0; + mode_t mode = 0; + + return shm_open( name, oflag, mode ); +} diff --git a/testsuites/psxtests/psxhdrs/sys/mman/shm_unlink.c b/testsuites/psxtests/psxhdrs/sys/mman/shm_unlink.c new file mode 100644 index 0000000000..182f796cee --- /dev/null +++ b/testsuites/psxtests/psxhdrs/sys/mman/shm_unlink.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Gedare Bloom. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +/* This test file is used to verify that the header files associated with + * invoking this function are correct. + */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int test( void ); + +int test( void ) +{ + char *name = "test"; + + return shm_unlink( name ); +} -- cgit v1.2.3