Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2004 02:26:25 +0100
From:      "Walter C. Pelissero" <walter@pelissero.de>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Acu Cobol 6.0 for Linux
Message-ID:  <16416.19009.687804.858168@hyde.home.loc>
In-Reply-To: <20040203192031.GB77596@dan.emsphone.com>
References:  <16409.17392.62258.191839@hyde.home.loc> <200401291747.i0THlLL04725@clunix.cl.msu.edu> <16415.61145.783013.602178@hyde.home.loc> <20040203192031.GB77596@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?16416.19009.687804.858168>