Samba pre-2.0.7 snapshot available.
Andy Bakun
abakun at reac.com
Wed Feb 2 20:54:38 GMT 2000
Greg Dickie wrote:
> hmmmm.Iuse the irix cc and it's fine?
Heh, I don't know which is worse: gcc on Irix or the standard SGI cc. Doesn't
matter, since I don't have access to the SGI supplied cc anyway.
The alignment problem with gcc that Don Badrak provides a fix for apparently
works. See the end of this message for a C program that detects if his patch is
necessary.
You see this in the log:
> [2000/01/29 09:02:36, 0] locking/shmem_sysv.c:sysv_shm_open(593)
> ERROR semctl: can't IPC_STAT. Error was Bad address
> [2000/01/29 09:02:36, 0] locking/locking.c:locking_init(174)
> ERROR: Failed to initialise share modes
> [2000/01/29 09:02:36, 0] locking/shmem_sysv.c:sysv_shm_open(593)
> ERROR semctl: can't IPC_STAT. Error was Bad address
> [2000/01/29 09:02:36, 0] locking/locking.c:locking_init(174)
> ERROR: Failed to initialise share modes
That fix is to patch locking/shmem_sysv.c with
#ifdef USE_SYSV_IPC
+#ifdef SGI_SEMUN_HACK
+union semun_hack {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+ char __dummy[5];
+};
+#define semun semun_hack
+#endif
and it works.
Here's a quick program to detech if SGI_SEMUN_HACK needs to be defined. Might
need to clean it up before using it in the autoconf stuff.
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#ifdef _SEM_SEMUN_UNDEFINED
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
};
#endif
union semun_hack {
int val;
struct semid_ds *buf;
unsigned short *array;
char __dummy[5];
};
main() {
struct semid_ds sem_ds;
union semun_hack suh;
union semun su;
int sem_id, ret;
sem_id = semget(0xdead6666,1,IPC_CREAT|IPC_EXCL|0777);
su.buf = &sem_ds;
suh.buf = &sem_ds;
ret = 0;
if (sem_id == -1) {
ret = 1;
} else {
if ((semctl(sem_id, 0, IPC_STAT, su) != 0) &&
(semctl(sem_id, 0, IPC_STAT, suh) == 0)) {
ret = 1;
}
}
semctl(sem_id, 0, IPC_RMID, 0);
return ret;
}
Returns 0 for Linux (gcc 2.7.2.3, according to sys/sem.h, definition of semun is
required for Linux (by the ipc standard?)), and returns 1 for gcc 2.8.1 on Irix
6.5. That's all I have access to... might want to test it on other systems which
are known to have gcc's that align properly. For gcc's that align properly, it
should return 0.
I originally wrote this to actually determine if the alignment was screwed up, but
that was more involved than just seeing if the syscall failed.
Andy.
More information about the samba-technical
mailing list