diff options
Diffstat (limited to 'testsuites/psxtests/psxhdrs/unistd')
22 files changed, 661 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxhdrs/unistd/alarm.c b/testsuites/psxtests/psxhdrs/unistd/alarm.c new file mode 100644 index 0000000000..7ca0e3cae7 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/alarm.c @@ -0,0 +1,31 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + unsigned int seconds; + unsigned int result; + + seconds = 10; + + result = alarm( seconds ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/fdatasync.c b/testsuites/psxtests/psxhdrs/unistd/fdatasync.c new file mode 100644 index 0000000000..4a0f9a503d --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/fdatasync.c @@ -0,0 +1,30 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + int fd; + int result; + + fd = 4; + result = fdatasync( fd ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/fsync.c b/testsuites/psxtests/psxhdrs/unistd/fsync.c new file mode 100644 index 0000000000..188a91e5e0 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/fsync.c @@ -0,0 +1,30 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + int fd; + int result; + + fd = 4; + result = fsync( fd ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getegid.c b/testsuites/psxtests/psxhdrs/unistd/getegid.c new file mode 100644 index 0000000000..c4698badeb --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getegid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> +#include <sys/types.h> + +int test( void ); + +int test( void ) +{ + gid_t gid; + + gid = getegid(); + + return gid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/geteuid.c b/testsuites/psxtests/psxhdrs/unistd/geteuid.c new file mode 100644 index 0000000000..beffd5ae6c --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/geteuid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> +#include <sys/types.h> + +int test( void ); + +int test( void ) +{ + uid_t uid; + + uid = geteuid(); + + return uid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getgid.c b/testsuites/psxtests/psxhdrs/unistd/getgid.c new file mode 100644 index 0000000000..515c7144a4 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getgid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> +#include <sys/types.h> + +int test( void ); + +int test( void ) +{ + gid_t gid; + + gid = getgid(); + + return gid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getgroups.c b/testsuites/psxtests/psxhdrs/unistd/getgroups.c new file mode 100644 index 0000000000..4402251914 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getgroups.c @@ -0,0 +1,33 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + gid_t grouplist[ 20 ]; + int gidsetsize; + int result; + + gidsetsize = 20; + + result = getgroups( gidsetsize, grouplist ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getlogin.c b/testsuites/psxtests/psxhdrs/unistd/getlogin.c new file mode 100644 index 0000000000..e7ace225e7 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getlogin.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + char *loginname; + + loginname = getlogin(); + + return (loginname == NULL) ? -1 : 0; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getlogin_r.c b/testsuites/psxtests/psxhdrs/unistd/getlogin_r.c new file mode 100644 index 0000000000..78d6de1d05 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getlogin_r.c @@ -0,0 +1,31 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> +#include <limits.h> /* for LOGIN_NAME_MAX */ + +int test( void ); + +int test( void ) +{ + char loginnamebuffer[ LOGIN_NAME_MAX ]; + int result; + + result = getlogin_r( loginnamebuffer, LOGIN_NAME_MAX ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getpgrp.c b/testsuites/psxtests/psxhdrs/unistd/getpgrp.c new file mode 100644 index 0000000000..fc11fe2171 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getpgrp.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + pid_t pgrp; + + pgrp = getpgrp(); + + return (pgrp == -1) ? -1 : 0; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getpid.c b/testsuites/psxtests/psxhdrs/unistd/getpid.c new file mode 100644 index 0000000000..67505c6fe7 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getpid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + pid_t pid; + + pid = getpid(); + + return pid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getppid.c b/testsuites/psxtests/psxhdrs/unistd/getppid.c new file mode 100644 index 0000000000..1ac195208f --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getppid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + pid_t pid; + + pid = getppid(); + + return pid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/getuid.c b/testsuites/psxtests/psxhdrs/unistd/getuid.c new file mode 100644 index 0000000000..7a08340e83 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/getuid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> +#include <sys/types.h> + +int test( void ); + +int test( void ) +{ + uid_t uid; + + uid = getuid(); + + return uid; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/pause.c b/testsuites/psxtests/psxhdrs/unistd/pause.c new file mode 100644 index 0000000000..643be398cf --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/pause.c @@ -0,0 +1,28 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + int result; + + result = pause(); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/setgid.c b/testsuites/psxtests/psxhdrs/unistd/setgid.c new file mode 100644 index 0000000000..ac3be6af96 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/setgid.c @@ -0,0 +1,32 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + gid_t gid; + int result; + + gid = 0; + + result = setgid( gid ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/setpgid.c b/testsuites/psxtests/psxhdrs/unistd/setpgid.c new file mode 100644 index 0000000000..daed07f6b1 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/setpgid.c @@ -0,0 +1,31 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + pid_t pid = 0; + pid_t pgid = 0; + int result; + + result = setpgid( pid, pgid ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/setsid.c b/testsuites/psxtests/psxhdrs/unistd/setsid.c new file mode 100644 index 0000000000..7bb043453e --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/setsid.c @@ -0,0 +1,29 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + pid_t pid; + + pid = setsid(); + + return (pid == -1) ? -1 : 0; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/setuid.c b/testsuites/psxtests/psxhdrs/unistd/setuid.c new file mode 100644 index 0000000000..28457edba8 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/setuid.c @@ -0,0 +1,32 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <sys/types.h> +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + uid_t uid; + int result; + + uid = 0; + + result = setuid( uid ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/sleep.c b/testsuites/psxtests/psxhdrs/unistd/sleep.c new file mode 100644 index 0000000000..aca31da98d --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/sleep.c @@ -0,0 +1,31 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + unsigned int seconds; + unsigned int result; + + seconds = 10; + + result = sleep( seconds ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/sync.c b/testsuites/psxtests/psxhdrs/unistd/sync.c new file mode 100644 index 0000000000..bc6992c01c --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/sync.c @@ -0,0 +1,24 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +void test( void ); + +void test( void ) +{ + sync(); +} diff --git a/testsuites/psxtests/psxhdrs/unistd/ualarm.c b/testsuites/psxtests/psxhdrs/unistd/ualarm.c new file mode 100644 index 0000000000..bec71d03b3 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/ualarm.c @@ -0,0 +1,37 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <signal.h> + +/* FIXME: POSIX.1-2001 marks ualarm() as obsolete. + * POSIX.1-2008 removes the specification of ualarm(). */ + +useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval)); +int test( void ); + +int test( void ) +{ + useconds_t useconds; + useconds_t interval; + useconds_t result; + + useconds = 10; + interval = 10; + + result = ualarm( useconds, interval ); + + return (result == 0) ? 0 : -1; +} diff --git a/testsuites/psxtests/psxhdrs/unistd/usleep.c b/testsuites/psxtests/psxhdrs/unistd/usleep.c new file mode 100644 index 0000000000..f4125d1432 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/unistd/usleep.c @@ -0,0 +1,30 @@ +/* + * This test file is used to verify that the header files associated with + * invoking this function are correct. + * + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> + +int test( void ); + +int test( void ) +{ + useconds_t usec; + unsigned result; + + usec = 0; + result = usleep( usec ); + + return result; +} |