Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jan 2011 11:40:57 +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:  <20110106104057.GB59969@curry.mchp.siemens.de>
In-Reply-To: <20110106090130.20784sf1w9verdic@webmail.leidinger.net>
References:  <20101230075124.GA12923@curry.mchp.siemens.de> <20101231144800.00005c6d@unknown> <20110101224629.GA30540@curry.mchp.siemens.de> <20110102115021.00000c8b@unknown> <20110105191915.GA43997@curry.mchp.siemens.de> <20110106090130.20784sf1w9verdic@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 06-Jan-2011 at 09:01:30 +0100, Alexander Leidinger wrote:
> Quoting Andre Albsmeier <Andre.Albsmeier@siemens.com> (from Wed, 5 Jan  
> 2011 20:19:15 +0100):
> 
> > 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).
> 
> What does it expect as a filesystem type if it does not find shmfs in  
> fstab but tmpfs? If it does not find tmpfs, will it try /tmp anyway  
> (but check for some fstype magic)?

It searches for every mount which is of type tmpfs or shm.
Whatever it finds must have the fs magic SHMFS_SUPER_MAGIC
(0x01021994). It's in sysdeps/unix/sysv/linux/shm_open.c:

------------------------- snip -------------------

  /* Now read the entries.  */
  while ((mp = __getmntent_r (fp, &resmem, buf, sizeof buf)) != NULL)
    /* The original name is "shm" but this got changed in early Linux
       2.4.x to "tmpfs".  */
    if (strcmp (mp->mnt_type, "tmpfs") == 0
#ifndef __ASSUME_TMPFS_NAME
        || strcmp (mp->mnt_type, "shm") == 0
#endif
        )
      {
        /* Found it.  There might be more than one place where the
           filesystem is mounted but one is enough for us.  */
        size_t namelen;

        /* First make sure this really is the correct entry.  At least
           some versions of the kernel give wrong information because
           of the implicit mount of the shmfs for SysV IPC.  */
        if (__statfs (mp->mnt_dir, &f) != 0 || f.f_type != SHMFS_SUPER_MAGIC)
          continue;

------------------------- snap -------------------

	-Andre

> 
> Bye,
> Alexander.
> 
> -- 
> Money cannot buy love, nor even friendship.
> 
> http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
> http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137
> 

-- 
FreeBSD: We eat penguins for breakfast



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