diff options
Diffstat (limited to 'c/src/exec')
-rw-r--r-- | c/src/exec/aclocal.m4 | 31 | ||||
-rw-r--r-- | c/src/exec/configure | 84 | ||||
-rw-r--r-- | c/src/exec/score/cpu/unix/cpu.c | 22 | ||||
-rw-r--r-- | c/src/exec/score/cpu/unix/wrap/Makefile.in | 2 |
4 files changed, 95 insertions, 44 deletions
diff --git a/c/src/exec/aclocal.m4 b/c/src/exec/aclocal.m4 index 836355604e..6a0fac6320 100644 --- a/c/src/exec/aclocal.m4 +++ b/c/src/exec/aclocal.m4 @@ -687,26 +687,44 @@ dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally dnl modify any existing key sets. See the man pages for semget, shmget, dnl msgget, semctl, shmctl and msgctl for details. +AC_DEFUN(RTEMS_UNION_SEMUN, +[ +AC_CACHE_CHECK([whether $RTEMS_HOST defines union semun], + rtems_cv_HAS_UNION_SEMUN, + [AC_TRY_COMPILE([ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h>], +[union semun arg ;], +[rtems_cv_HAS_UNION_SEMUN="yes"], +[rtems_cv_HAS_UNION_SEMUN="no"]) + +if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then + AC_DEFINE(HAS_UNION_SEMUN) +fi]) +]) + AC_DEFUN(RTEMS_SYSV_SEM, [AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([RTEMS_CANONICAL_HOST]) AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores, rtems_cv_sysv_sem, [ -AC_TRY_RUN([ +AC_TRY_RUN( +[ #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> -int main () { -#if !defined(sun) - union semun arg ; -#else +#if !HAS_UNION_SEMUN union semun { int val; struct semid_ds *buf; ushort *array; - } arg; + } ; #endif +int main () { + union semun arg ; + int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); if (id == -1) exit(1); @@ -769,6 +787,7 @@ rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :) AC_DEFUN(RTEMS_CHECK_SYSV_UNIX, [AC_REQUIRE([RTEMS_CANONICAL_HOST]) if test "$RTEMS_CPU" = "unix" ; then + RTEMS_UNION_SEMUN RTEMS_SYSV_SEM if test "$rtems_cv_sysv_sem" != "yes" ; then AC_MSG_ERROR([System V semaphores don't work, required by simulator]) diff --git a/c/src/exec/configure b/c/src/exec/configure index 790b32ceb5..c53cc149de 100644 --- a/c/src/exec/configure +++ b/c/src/exec/configure @@ -2287,10 +2287,48 @@ fi if test "$RTEMS_CPU" = "unix" ; then + +echo $ac_n "checking whether $RTEMS_HOST defines union semun""... $ac_c" 1>&6 +echo "configure:2293: checking whether $RTEMS_HOST defines union semun" >&5 +if eval "test \"`echo '$''{'rtems_cv_HAS_UNION_SEMUN'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2298 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h> +int main() { +union semun arg ; +; return 0; } +EOF +if { (eval echo configure:2308: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + rtems_cv_HAS_UNION_SEMUN="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + rtems_cv_HAS_UNION_SEMUN="no" +fi +rm -f conftest* + +if test "$rtems_cv_HAS_UNION_SEMUN" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAS_UNION_SEMUN 1 +EOF + +fi +fi + +echo "$ac_t""$rtems_cv_HAS_UNION_SEMUN" 1>&6 + echo $ac_n "checking whether $RTEMS_HOST supports System V semaphores""... $ac_c" 1>&6 -echo "configure:2294: checking whether $RTEMS_HOST supports System V semaphores" >&5 +echo "configure:2332: checking whether $RTEMS_HOST supports System V semaphores" >&5 if eval "test \"`echo '$''{'rtems_cv_sysv_sem'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2299,22 +2337,22 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2303 "configure" +#line 2341 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> -int main () { -#if !defined(sun) - union semun arg ; -#else +#if !HAS_UNION_SEMUN union semun { int val; struct semid_ds *buf; ushort *array; - } arg; + } ; #endif +int main () { + union semun arg ; + int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400); if (id == -1) exit(1); @@ -2325,7 +2363,7 @@ int main () { } EOF -if { (eval echo configure:2329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rtems_cv_sysv_sem="yes" else @@ -2348,7 +2386,7 @@ echo "$ac_t""$rtems_cv_sysv_sem" 1>&6 echo $ac_n "checking whether $RTEMS_HOST supports System V shared memory""... $ac_c" 1>&6 -echo "configure:2352: checking whether $RTEMS_HOST supports System V shared memory" >&5 +echo "configure:2390: checking whether $RTEMS_HOST supports System V shared memory" >&5 if eval "test \"`echo '$''{'rtems_cv_sysv_shm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2357,7 +2395,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2361 "configure" +#line 2399 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2373,7 +2411,7 @@ int main () { } EOF -if { (eval echo configure:2377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rtems_cv_sysv_shm="yes" else @@ -2396,7 +2434,7 @@ echo "$ac_t""$rtems_cv_sysv_shm" 1>&6 echo $ac_n "checking whether $RTEMS_HOST supports System V messages""... $ac_c" 1>&6 -echo "configure:2400: checking whether $RTEMS_HOST supports System V messages" >&5 +echo "configure:2438: checking whether $RTEMS_HOST supports System V messages" >&5 if eval "test \"`echo '$''{'rtems_cv_sysv_msg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2405,7 +2443,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2409 "configure" +#line 2447 "configure" #include "confdefs.h" #include <sys/types.h> @@ -2421,7 +2459,7 @@ int main () { } EOF -if { (eval echo configure:2425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then rtems_cv_sysv_msg="yes" else @@ -2445,7 +2483,7 @@ fi echo $ac_n "checking for newlib""... $ac_c" 1>&6 -echo "configure:2449: checking for newlib" >&5 +echo "configure:2487: checking for newlib" >&5 if eval "test \"`echo '$''{'rtems_cv_use_newlib'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2454,14 +2492,14 @@ else CC=$CC_FOR_TARGET cat > conftest.$ac_ext <<EOF -#line 2458 "configure" +#line 2496 "configure" #include "confdefs.h" extern int not_required_by_rtems() ; int main() { not_required_by_rtems() ; return 0; } EOF -if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* rtems_cv_use_newlib="yes" else @@ -2472,14 +2510,14 @@ rm -f conftest* if test -z "$rtems_cv_use_newlib"; then cat > conftest.$ac_ext <<EOF -#line 2476 "configure" +#line 2514 "configure" #include "confdefs.h" extern int rtems_provides_crt0 ; int main() { rtems_provides_crt0 = 0 ; return 0; } EOF -if { (eval echo configure:2483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* rtems_cv_use_newlib="yes" else @@ -2500,7 +2538,7 @@ RTEMS_USE_NEWLIB="$rtems_cv_use_newlib" # Check if there is custom/*.cfg for this BSP echo $ac_n "checking for make/custom/$RTEMS_BSP.cfg""... $ac_c" 1>&6 -echo "configure:2504: checking for make/custom/$RTEMS_BSP.cfg" >&5 +echo "configure:2542: checking for make/custom/$RTEMS_BSP.cfg" >&5 if test -r "$srcdir/$RTEMS_TOPdir/make/custom/$RTEMS_BSP.cfg"; then echo "$ac_t""yes" 1>&6 else @@ -2508,7 +2546,7 @@ else fi echo $ac_n "checking whether BSP supports multiprocessing""... $ac_c" 1>&6 -echo "configure:2512: checking whether BSP supports multiprocessing" >&5 +echo "configure:2550: checking whether BSP supports multiprocessing" >&5 if eval "test \"`echo '$''{'rtems_cv_HAS_MP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2532,7 +2570,7 @@ fi echo $ac_n "checking whether BSP supports libposix""... $ac_c" 1>&6 -echo "configure:2536: checking whether BSP supports libposix" >&5 +echo "configure:2574: checking whether BSP supports libposix" >&5 if eval "test \"`echo '$''{'rtems_cv_HAS_POSIX_API'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2561,7 +2599,7 @@ fi # find all the Executive Makefiles echo $ac_n "checking for Makefile.in in score/cpu/$RTEMS_CPU""... $ac_c" 1>&6 -echo "configure:2565: checking for Makefile.in in score/cpu/$RTEMS_CPU" >&5 +echo "configure:2603: checking for Makefile.in in score/cpu/$RTEMS_CPU" >&5 if test -d $srcdir/score/cpu/$RTEMS_CPU; then rtems_av_save_dir=`pwd`; cd $srcdir; diff --git a/c/src/exec/score/cpu/unix/cpu.c b/c/src/exec/score/cpu/unix/cpu.c index 3b3dbcd383..4f1812b9d1 100644 --- a/c/src/exec/score/cpu/unix/cpu.c +++ b/c/src/exec/score/cpu/unix/cpu.c @@ -991,25 +991,19 @@ void _CPU_SHM_Init( if ( is_master_node ) { for ( i=0 ; i <= maximum_nodes ; i++ ) { -#if defined(solaris2) +#if !HAS_UNION_SEMUN union semun { int val; struct semid_ds *buf; - ushort *array; - } help; - - help.val = 1; - status = semctl( _CPU_SHM_Semid, i, SETVAL, help ); -#elif defined(__linux__) || defined(__FreeBSD__) - union semun help; - + unsigned short int *array; +#if defined(__linux__) + struct seminfo *__buf; +#endif + } ; +#endif + union semun help ; help.val = 1; status = semctl( _CPU_SHM_Semid, i, SETVAL, help ); -#elif defined(hpux) - status = semctl( _CPU_SHM_Semid, i, SETVAL, 1 ); -#else -#error "Not a supported unix variant" -#endif fix_syscall_errno(); /* in case of newlib */ if ( status == -1 ) { diff --git a/c/src/exec/score/cpu/unix/wrap/Makefile.in b/c/src/exec/score/cpu/unix/wrap/Makefile.in index ca39368399..925e5f9a42 100644 --- a/c/src/exec/score/cpu/unix/wrap/Makefile.in +++ b/c/src/exec/score/cpu/unix/wrap/Makefile.in @@ -53,7 +53,7 @@ $(INSTALLDIRS): # (OPTIONAL) Add local stuff here using += # -DEFINES += -DCPU_SYNC_IO $(LIBC_DEFINES) +DEFINES += -DCPU_SYNC_IO $(LIBC_DEFINES) @DEFS@ CPPFLAGS += -I$(srcdir)/.. CFLAGS += $(CFLAGS_OS_V) |