Skip site navigation (1)Skip section navigation (2)
Date:      01 Jun 1998 19:01:44 -0400
From:      Kevin Street <street@iname.com>
To:        Amancio Hasty <hasty@rah.star-gate.com>
Cc:        Terry Lambert <tlambert@primenet.com>, mike@smith.net.au, rminnich@Sarnoff.COM, doconnor@gsoft.com.au, hackers@FreeBSD.ORG
Subject:   Re: Star Office Installation
Message-ID:  <87d8csvi93.fsf@kstreet.interlog.com>
In-Reply-To: Amancio Hasty's message of "Sun, 31 May 1998 02:42:44 -0700"
References:  <199805310942.CAA20634@rah.star-gate.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Amancio Hasty <hasty@rah.star-gate.com> writes:

> Well, I guess on Linux star office misbehaves by deleting its ipc
> shared data segments when it exits.
> 
> Most likely whats going is that we are not handling properly the ipc
> calls or possibly something else which is causing Star Office not
> to delete the ipc shared data segments upon exit.

I have a possible fix for this.  I have not tested this with Star
Office (I downloaded 3.1 which does not have the problem, I took a
look for 4, but at the dl rate I'm currently getting it's an 8 hour
download ... I'm not going to do this) but x11amp was also leaving
shared segments around and it's a *lot* smaller.  x11amp appears to be
calling shmctl(id, IPC_RMID, 0) and the emulation layer does not like
the null shmid_ds buffer pointer.  The emulation layer returned an
error without ever calling FreeBSD's shmctl, so the segments were not
being deleted when the reference count went to zero.  I think there's
a high probability that Star Office does the same thing.

Can someone who has Star Office 4 try this patch out and confirm
whether this works for Star Office too?

To try it:
save the following patch to /tmp/linux.pat

modstat
modunload -i <id>

cd /usr/src/sys/i386/linux
patch < /tmp/linux.pat

cd /usr/src/lkm/linux
make all install

linux
run star office and check to see if the shared segments are being
cleaned up after it exits.

Here's the patch to /usr/src/sys/i386/linux/linux_ipc.c

*** linux_ipc.c.orig	Mon Jun  1 11:35:17 1998
--- linux_ipc.c	Mon Jun  1 14:02:11 1998
***************
*** 430,443 ****
      case LINUX_IPC_RMID:
  	bsd_args.shmid = args->arg1;
  	bsd_args.cmd = IPC_RMID;
! 	if ((error = copyin(args->ptr, (caddr_t)&linux_shmid, 
! 		    	    sizeof(linux_shmid))))
! 	    return error;
! 	linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid);
! 	bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
! 	if ((error = copyout((caddr_t)&bsd_shmid, (caddr_t)bsd_args.buf,
! 		     	     sizeof(struct shmid_ds))))
! 	    return error;
  	return shmctl(p, &bsd_args);
  
      case LINUX_IPC_INFO:
--- 430,447 ----
      case LINUX_IPC_RMID:
  	bsd_args.shmid = args->arg1;
  	bsd_args.cmd = IPC_RMID;
! 	if (NULL == args->ptr)
! 	    bsd_args.buf = NULL;
! 	else {
! 	    if ((error = copyin(args->ptr, (caddr_t)&linux_shmid, 
! 		    		sizeof(linux_shmid))))
! 		return error;
! 	    linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid);
! 	    bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds));
! 	    if ((error = copyout((caddr_t)&bsd_shmid, (caddr_t)bsd_args.buf,
! 		     		 sizeof(struct shmid_ds))))
! 		return error;
! 	}
  	return shmctl(p, &bsd_args);
  
      case LINUX_IPC_INFO:

-- 
Kevin Street
street@iName.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



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