Subject: Re: ipc errors/Linux Emulation NetBSD-3BETA using Oracle
To: Chuck Silvers <chuq@chuq.com>
From: Jose Luis Rodriguez Garcia <jose.l.rodriguez@getronics.com>
List: current-users
Date: 11/02/2005 15:18:29
It fails in the same call(ipc):
  741 oracle   CALL  ipc(0x18,0x90000,0x102,0,0xbfbfd8c0)
  741 oracle   RET   ipc -1 errno -22 Invalid argument

Chuck Silvers wrote:

>On Wed, Nov 02, 2005 at 08:04:49AM +0100, GNMJLR@terra.es wrote:
>  
>
>>The error that produces that Oracle ends i the call: ipc(0x18,0xd0000,
>>0x102,0,0xbfbfd8d0)
>>
>>The question: where can I find doc about decoding 
>>the parameters of ipc?
>>
>>
>>After this Oracle quits and prints this:
>>
>>skgm 
>>error 27121: errno = 22, info = 1, 917504, 0, 0
>>OPIRIP: Uncaught error 
>>1034. Error stack:
>>ORA-01034: ORACLE not available
>>ORA-27121: unable to 
>>determine size of shared memory segment
>>Linux Error: 22: Invalid argument
>>    
>>
>
>try the attached patch.
>
>-Chuck
>  
>
>------------------------------------------------------------------------
>
>Index: src/sys/compat/linux/common/linux_ipc.c
>===================================================================
>RCS file: /cvsroot/src/sys/compat/linux/common/linux_ipc.c,v
>retrieving revision 1.31
>diff -u -p -r1.31 linux_ipc.c
>--- src/sys/compat/linux/common/linux_ipc.c	26 Feb 2005 23:10:19 -0000	1.31
>+++ src/sys/compat/linux/common/linux_ipc.c	2 Nov 2005 10:47:11 -0000
>@@ -469,6 +469,7 @@ linux_sys_shmctl(l, v, retval)
> 	struct sys___shmctl13_args nua;
> 	struct shmid_ds *bsp, bs;
> 	struct linux_shmid_ds ls;
>+	struct linux_shminfo64 lsi;
> 	int error;
> 
> 	SCARG(&nua, shmid) = SCARG(uap, shmid);
>@@ -484,6 +485,7 @@ linux_sys_shmctl(l, v, retval)
> 			return error;
> 		bsd_to_linux_shmid_ds(&bs, &ls);
> 		return copyout(&ls, SCARG(uap, buf), sizeof ls);
>+
> 	case LINUX_IPC_SET:
> 		if ((error = copyin(SCARG(uap, buf), &ls, sizeof ls)))
> 			return error;
>@@ -495,19 +497,31 @@ linux_sys_shmctl(l, v, retval)
> 		SCARG(&nua, cmd) = IPC_SET;
> 		SCARG(&nua, buf) = bsp;
> 		break;
>+
> 	case LINUX_IPC_RMID:
> 		SCARG(&nua, cmd) = IPC_RMID;
> 		SCARG(&nua, buf) = NULL;
> 		break;
>+
> 	case LINUX_SHM_LOCK:
> 		SCARG(&nua, cmd) = SHM_LOCK;
> 		SCARG(&nua, buf) = NULL;
> 		break;
>+
> 	case LINUX_SHM_UNLOCK:
> 		SCARG(&nua, cmd) = SHM_UNLOCK;
> 		SCARG(&nua, buf) = NULL;
> 		break;
>+
> 	case LINUX_IPC_INFO:
>+		memset(&lsi, 0, sizeof lsi);
>+		lsi.l_shmmax = shminfo.shmmax;
>+		lsi.l_shmmin = shminfo.shmmin;
>+		lsi.l_shmmni = shminfo.shmmni;
>+		lsi.l_shmseg = shminfo.shmseg;
>+		lsi.l_shmall = shminfo.shmall;
>+		return copyout(&lsi, SCARG(uap, buf), sizeof lsi);
>+
> 	case LINUX_SHM_STAT:
> 	case LINUX_SHM_INFO:
> 	default:
>Index: src/sys/compat/linux/common/linux_shm.h
>===================================================================
>RCS file: /cvsroot/src/sys/compat/linux/common/linux_shm.h,v
>retrieving revision 1.6
>diff -u -p -r1.6 linux_shm.h
>--- src/sys/compat/linux/common/linux_shm.h	28 Sep 2004 19:05:19 -0000	1.6
>+++ src/sys/compat/linux/common/linux_shm.h	2 Nov 2005 10:47:12 -0000
>@@ -58,6 +58,27 @@ struct linux_shmid_ds {
> 	void			*l_private3;
> };
> 
>+struct linux_shminfo64 {
>+	u_long			l_shmmax;
>+	u_long			l_shmmin;
>+	u_long			l_shmmni;
>+	u_long			l_shmseg;
>+	u_long			l_shmall;
>+	u_long			l___unused1;
>+	u_long			l___unused2;
>+	u_long			l___unused3;
>+	u_long			l___unused4;
>+};
>+
>+struct linux_shm_info {
>+	int			l_used_ids;
>+	u_long			l_shm_tot;
>+	u_long			l_shm_rss;
>+	u_long			l_shm_swp;
>+	u_long			l_swap_attempts;
>+	u_long			l_swap_successes;
>+};
>+
> #define LINUX_SHM_RDONLY	0x1000
> #define LINUX_SHM_RND		0x2000
> #define LINUX_SHM_REMAP		0x4000
>  
>