Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:37

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *  COPYRIGHT (c) 1989-2010.
0005  *  On-Line Applications Research Corporation (OAR).
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions
0009  * are met:
0010  * 1. Redistributions of source code must retain the above copyright
0011  *    notice, this list of conditions and the following disclaimer.
0012  * 2. Redistributions in binary form must reproduce the above copyright
0013  *    notice, this list of conditions and the following disclaimer in the
0014  *    documentation and/or other materials provided with the distribution.
0015  *
0016  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0017  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0019  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0020  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0021  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0022  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0023  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0024  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0025  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0026  * POSSIBILITY OF SUCH DAMAGE.
0027  */
0028 
0029 #ifdef HAVE_CONFIG_H
0030 #include "config.h"
0031 #endif
0032 
0033 #include <sys/types.h>
0034 #include <sys/wait.h>
0035 #include <sys/mman.h>
0036 #include <pthread.h>
0037 
0038 #define CONFIGURE_INIT
0039 #include "system.h"
0040 #include "tmacros.h"
0041 
0042 #include <aio.h>
0043 #include <time.h>
0044 #include <unistd.h>
0045 #include <sched.h>
0046 
0047 const char rtems_test_name[] = "PSXENOSYS";
0048 
0049 void check_enosys(int status);
0050 
0051 void check_enosys(int status)
0052 {
0053   if ( (status == -1) && (errno == ENOSYS) )
0054     return;
0055   rtems_test_exit(0);
0056 }
0057 
0058 void *POSIX_Init(
0059   void *argument
0060 )
0061 {
0062   int             sc;
0063 
0064   TEST_BEGIN();
0065 
0066 #ifndef RTEMS_POSIX_API
0067   sc = lio_listio( 0, NULL, 0, NULL );
0068   check_enosys( sc );
0069 #endif
0070 
0071   sc = aio_suspend( NULL, 0, NULL );
0072   check_enosys( sc );
0073 
0074   sc = clock_getcpuclockid( 0, NULL );
0075   check_enosys( sc );
0076 
0077   sc = execl( NULL, NULL, (char*)0 );
0078   check_enosys( sc );
0079 
0080   sc = execle( NULL, NULL, (char*)0, NULL );
0081   check_enosys( sc );
0082 
0083   sc = execlp( NULL, NULL, (char*)0 );
0084   check_enosys( sc );
0085 
0086   sc = execv( NULL, NULL );
0087   check_enosys( sc );
0088 
0089   sc = execve( NULL, NULL, NULL );
0090   check_enosys( sc );
0091 
0092   sc = execvp( NULL, NULL );
0093   check_enosys( sc );
0094 
0095   sc = fork();
0096   check_enosys( sc );
0097 
0098   /*
0099    * The behavior of pthread_atfork() in single process environments was
0100    * undefined by POSIX but the fACE Technical Standard required returning
0101    * 0. Before ticket #4713, this did return ENOSYS. Just leaving this test
0102    * case here for convenience.
0103    */
0104   sc = pthread_atfork( NULL, NULL, NULL );
0105   rtems_test_assert( !sc );
0106 
0107   sc = pthread_getcpuclockid( 0, NULL );
0108   check_enosys( sc );
0109 
0110   sc = sched_setparam( 0, NULL );
0111   check_enosys( sc );
0112 
0113   sc = sched_getparam( 0, NULL );
0114   check_enosys( sc );
0115 
0116   sc = sched_setscheduler( 0, 0, NULL );
0117   check_enosys( sc );
0118 
0119   sc = sched_getscheduler( 0 );
0120   check_enosys( sc );
0121 
0122   sc = wait( NULL );
0123   check_enosys( sc );
0124 
0125   sc = waitpid( 0, NULL, 0 );
0126   check_enosys( sc );
0127 
0128   sc = mprotect( NULL, 0, 0 );
0129   posix_service_failed( sc, "mprotect" );
0130 
0131   sc = vfork();
0132   if ( sc != -1 ) {
0133     rtems_test_exit( 0 );
0134   }
0135 
0136   TEST_END();
0137   rtems_test_exit( 0 );
0138 
0139   return NULL; /* just so the compiler thinks we returned something */
0140 }