From ea562ee977d4b48500a9b117e543e9c4ae0eb05e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 12 Aug 1999 18:22:17 +0000 Subject: Patch from Ralf Corsepius : After upgrading my linux box to the brand new SuSE 6.2 release, which is glibc-2.1 based, I came across a bug in RTEMS - IIRC, I even warned you about it about 1/2 a year ago, but nothing has been done since then :-. The *.m4 macros to check for SYSV/IPC are broken for linux/glibc2.1, because they assume that linux always defines union semun, which isn't true anymore for glibc2.1 (the manpage for semctl states _X_OPEN specifies it this way). Therefore I have tried to implement a more general approach for handling SYSV for unix/posix which checks for presence of struct semun, instead of trying to evaluate OS specific preprocessor symbols. This approach is a bit adventureous, because I only tested it with linux/glibc2.1 and linux/libc5, but not under other Unix variants RTEMS supports. I am quite confident it will work on other hosts, too, but who knows :-. [FYI: I think this might also is the cause of some problems with RedHat 6.X / Mandrake linux recently reported on the rtems list -- rtems-4.0.0 can not be build for posix on any glibc2.1 based host] Furthermore the patch below contains a couple of minor fixes and configuration cleanups, which IMO should be applied before releasing a new snapshot. To apply this patch: cd patch -p1 < rtems-rc-19990709-8.diff ./autogen --- c/src/exec/score/cpu/unix/cpu.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'c/src/exec/score/cpu/unix/cpu.c') 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 ) { -- cgit v1.2.3