From owner-freebsd-arch@FreeBSD.ORG Sun May 10 20:02:46 2009 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DEA21065674 for ; Sun, 10 May 2009 20:02:46 +0000 (UTC) (envelope-from ntarmos@cs.uoi.gr) Received: from gaia.cs.uoi.gr (gaia.cs.uoi.gr [195.130.121.201]) by mx1.freebsd.org (Postfix) with ESMTP id B127C8FC1B for ; Sun, 10 May 2009 20:02:45 +0000 (UTC) (envelope-from ntarmos@cs.uoi.gr) Received: from zeus.cs.uoi.gr (zeus.cs.uoi.gr [195.130.121.11]) by gaia.cs.uoi.gr (8.14.1/8.14.1) with ESMTP id n4AJfgv1078930 for ; Sun, 10 May 2009 22:41:47 +0300 (EEST) (envelope-from ntarmos@cs.uoi.gr) Received: from zeus.cs.uoi.gr (localhost [127.0.0.1]) by zeus.cs.uoi.gr (8.13.5/8.13.5) with ESMTP id n4AJfZ6F001863 for ; Sun, 10 May 2009 22:41:40 +0300 (EEST) Received: (from ntarmos@localhost) by zeus.cs.uoi.gr (8.13.5/8.13.5/Submit) id n4AJfZWr001860 for arch@freebsd.org; Sun, 10 May 2009 22:41:35 +0300 (EEST) X-Authentication-Warning: zeus.cs.uoi.gr: ntarmos set sender to ntarmos@cs.uoi.gr using -f Date: Sun, 10 May 2009 22:41:33 +0300 From: Nikos Ntarmos To: arch@freebsd.org Message-ID: <20090510194133.GG20749@ace.cs.uoi.gr> References: <200905100500.n4A50GOa050728@hergotha.csail.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905100500.n4A50GOa050728@hergotha.csail.mit.edu> Organization: Computer Science Dept., U. of Ioannina, Greece WWW-Homepage: http://ntarmos.dyndns.org/ X-PGP-Fingerprint: 9680 60A7 DE60 0298 B1F0 9B22 9BA2 7569 CF95 160A Office-Phone: +30-26510-98866 GPS-Info: 39.617660N, 20.838790E User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.91.2/9350/Sun May 10 07:13:25 2009 on gaia.cs.uoi.gr X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (gaia.cs.uoi.gr [195.130.121.201]); Sun, 10 May 2009 22:41:47 +0300 (EEST) Cc: Subject: Re: Re[2]: Posix shared memory problem X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2009 20:02:46 -0000 On Sun, May 10, 2009 at 01:00:16AM -0400, Garrett Wollman wrote: > In > scholz@scriptolutions.com writes: > > >JT> shm_open/shm_unlink refer to the filesystem; they are fairly direct > >JT> wrappers around open and unlink. > > > >Question is where are they stored? > > In the fileststem, in the path that you specify. They are just > ordinary files. > > There was some thought that this was a bad (or at least > not-like-Linux) way of implementing this feature, so I believe > more-recent versions of FreeBSD do it differently. When I wrote this > code, I could not see any reason for the "path" argument to be > interpreted differently from any other path. FWIW the test code in the original email still fails even if an absolute path is used as a sem name, ie: sem_t *s = sem_open("/path/to/foobar", O_CREAT | O_EXCL, S_IWUSR, 0); with /path/to/foobar pointing to a user writable directory, segfaults with "invalid system call". Note that the error is not printed by perror(3) but by the system itself. A backtrace of the resulting core shows that the problem is burried deep in ksem_open(): ntarmos@ace:~% ./ts zsh: invalid system call (core dumped) ./ts ntarmos@ace:~% gdb -q ./ts ts.core Core was generated by `ts'. Program terminated with signal 12, Bad system call. Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x280c214b in ksem_open () from /lib/libc.so.7 (gdb) bt #0 0x280c214b in ksem_open () from /lib/libc.so.7 #1 0x280b78fc in sem_open () from /lib/libc.so.7 #2 0x080484e5 in main () at test-sem.c:7 (gdb) This is on i386/7.2-RELEASE. Cheers. \n\n