Acu Cobol 6.0 for Linux

Walter C. Pelissero walter at pelissero.de
Tue Feb 3 17:27:18 PST 2004


Dan Nelson writes:
 > If you do have sysvmsg loaded, you may have to start adding printfs in
 > linux_msgctl() to trace which call is failing and why.

Thanks.  With your hints I made an interesting discovery that allowed
me to improve the situation dramatically.

In Linux's /usr/include/linux/ipc.h there is an interesting comment:

  /*
   * Version flags for semctl, msgctl, and shmctl commands
   * These are passed as bitflags or-ed with the actual command
   */
  #define IPC_OLD 0       /* Old version (no 32-bit UID support on many
			     architectures) */
  #define IPC_64  0x0100  /* New version (support 32-bit UIDs, bigger
			     message sizes, etc. */

In fact linux_msgctl receives a command 0x102 instead of 2.  Although
the following patch fixes the problem related to msgctl, I'm not quite
sure it's enough to say that Acu Cobol runs perfectly on FreeBSD.
Actually I've got the feeling msgrcv still doesn't work as expected,
but I might be wrong.

I'll probably reach a certain confidence in the following days.

A side note.  What is the impact of this IPC_64 flag on the FreeBSD
code?  Can we ignore it, or does it mean that the Linux emulator is
outdated regarding this "new" flag?

Cheers,

-- 
walter pelissero
http://www.pelissero.de



Index: compat/linux/linux_ipc.c
===================================================================
RCS file: /usr/home/src.cvs/src/sys/compat/linux/linux_ipc.c,v
retrieving revision 1.17.2.3
diff -w -u -r1.17.2.3 linux_ipc.c
--- compat/linux/linux_ipc.c	5 Nov 2001 19:08:22 -0000	1.17.2.3
+++ compat/linux/linux_ipc.c	4 Feb 2004 00:33:56 -0000
@@ -233,7 +233,7 @@
 	bsd_args.semnum = args->semnum;
 	bsd_args.arg = unptr;
 
-	switch (args->cmd) {
+	switch (args->cmd & 0xff) { /* mask off the IPC_64 flag */
 	case LINUX_IPC_RMID:
 		bsd_args.cmd = IPC_RMID;
 		break;
@@ -362,7 +362,7 @@
     int error;
 
     bsd_args.msqid = args->msqid;
-    bsd_args.cmd = args->cmd;
+    bsd_args.cmd = args->cmd & 0xff; /* mask off the IPC_64 flag */
     bsd_args.buf = (struct msqid_ds *)args->buf;
     error = msgctl(p, &bsd_args);
     return ((args->cmd == LINUX_IPC_RMID && error == EINVAL) ? 0 : error);
@@ -429,7 +429,7 @@
     int error;
     caddr_t sg = stackgap_init();
 
-    switch (args->cmd) {
+    switch (args->cmd & 0xff) { /* mask off the IPC_64 flag */
     case LINUX_IPC_STAT:
 	bsd_args.shmid = args->shmid;
 	bsd_args.cmd = IPC_STAT;



More information about the freebsd-questions mailing list