Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 20:19:15 +0100
From:      Andre Albsmeier <Andre.Albsmeier@siemens.com>
To:        Alexander Leidinger <Alexander@leidinger.net>
Cc:        "freebsd-emulation@freebsd.org" <freebsd-emulation@freebsd.org>
Subject:   Re: 7.3-STABLE and Linux version of SIMetrix
Message-ID:  <20110105191915.GA43997@curry.mchp.siemens.de>
In-Reply-To: <20110102115021.00000c8b@unknown>
References:  <20101230075124.GA12923@curry.mchp.siemens.de> <20101231144800.00005c6d@unknown> <20110101224629.GA30540@curry.mchp.siemens.de> <20110102115021.00000c8b@unknown>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 02-Jan-2011 at 11:50:21 +0100, Alexander Leidinger wrote:
> On Sat, 1 Jan 2011 23:46:29 +0100 Andre Albsmeier
> <Andre.Albsmeier@siemens.com> wrote:
> 
> > On Fri, 31-Dec-2010 at 14:48:00 +0100, Alexander Leidinger wrote:
> > > On Thu, 30 Dec 2010 08:51:24 +0100 Andre Albsmeier
> > > <Andre.Albsmeier@siemens.com> wrote:
> > > 
> > > > I try to get the Linux version of SIMetrix (a very nice circuit
> > > > simulator) running. Everything looks fine: It starts, the GUI
> > > > comes up, you can draw schematics and so on. But when it comes
> > > > to simulation, the (SIMetrix-)console says:
> > > > 
> > > > *** Fatal error, out of memory ***
> > > > Could not allocate shared heap
> > > > Exception occurred while executing script command Run
> > > 
> > > Is there something in the dmesg output? In case it tries to execute
> > > an unsupported ioctl/syscall it should show up there. If not I
> > > suggest to give 8.x a try, it has an improved linuxulator.
> > 
> > Bad luck. I just started the PC-BSD 8.1 live system and
> > the error there is exactly the same...
> 
> Then there is only ktrace + linux_kdump (use the package) or dtrace
> left.

Got it running... A short explanation:

Linux' shm_open() fails because it wants to find some funky shmfs
to construct the full pathname. It starts to search at the default
mountpoint which is /dev/shm. If this fails it runs through fstab
and searches for shmfs and tmpfs. Whatever it finds will be
statfs()'ed to be checked for Linux' fs magic for shmfs (0x01021994).

My solution is eerie but it works. This is what I did:

1. cd /compat/linux
2. mkdir dev
3. cd dev
4. ln -s /tmp shm

This is not enough since statfs() won't return the proper magic
because it's no shmfs. So let's fix this ;-):

--- sys/compat/linux/linux_stats.c.ORI	2008-01-10 20:11:51.000000000 +0100
+++ sys/compat/linux/linux_stats.c	2011-01-05 20:04:18.000000000 +0100
@@ -379,6 +379,8 @@
 	struct statfs bsd_statfs;
 	char *path;
 	int error;
+	char* cp;
+	unsigned char shm = 0;
 
 	LCONVPATHEXIST(td, args->path, &path);
 
@@ -387,10 +389,15 @@
 		printf(ARGS(statfs, "%s, *"), path);
 #endif
 	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
+	if( (cp = strstr( path, "/dev/shm" )) != NULL )
+	  shm = ( cp[8] == '\0' || (cp[8] == '/' && cp[9] == '\0') );
+
 	LFREEPATH(path);
 	if (error)
 		return (error);
 	bsd_to_linux_statfs(&bsd_statfs, &linux_statfs);
+	if( shm )
+	  linux_statfs.f_type = 0x01021994;
 	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
 }
 

	-Andre

> 
> Bye,
> Alexander.

-- 
Amateurs like Linux, but professionals prefer FreeBSD.



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