From owner-freebsd-emulation Sun Aug 17 18:55:32 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id SAA11527 for emulation-outgoing; Sun, 17 Aug 1997 18:55:32 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA11522 for ; Sun, 17 Aug 1997 18:55:26 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id LAA08632; Mon, 18 Aug 1997 11:25:11 +0930 (CST) From: Michael Smith Message-Id: <199708180155.LAA08632@genesis.atrad.adelaide.edu.au> Subject: Re: semget in linux emulation? In-Reply-To: <199708050922.LAA04626@nietzsche.bowtie.nl> from Marc van Kempen at "Aug 5, 97 11:22:13 am" To: marc@bowtie.nl Date: Mon, 18 Aug 1997 11:25:11 +0930 (CST) Cc: emulation@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Ooh, old mail 8) Marc van Kempen stands accused of saying: > > I have a Linux application that I want to run on a > 2.2.2 system, but it seems to use shared memory. > I config'ed shared memory in my kernel. > > The application complains about a failing SEMGET, > and when I looked in the linux_ipc.c, the call returns > ENOSYS, does this mean that the semget won't work???? Yes. > If so, is anyone working on fixing this? Or, how difficult > is it to add? I don't believe so. Adding it basically just involves writing a shim that translates the Linux system call arguments/return to/from the BSD syscall arguments. It should be pretty straightforward, once you work out what the Linux code actually wants. Grr. Looking at the Linux section-2 manpages, they lay their shared-memory region out differently from ours. Theirs looks like : struct shmid_ds { struct ipc_perm shm_perm; /* operation perms */ int shm_segsz; /* size of segment (bytes) */ time_t shm_atime; /* last attach time */ time_t shm_dtime; /* last detach time */ time_t shm_ctime; /* last change time */ unsigned short shm_cpid; /* pid of creator */ unsigned short shm_lpid; /* pid of last operator */ short shm_nattch; /* no. of current attaches */ /* the following are private */ unsigned short shm_npages; /* size of segment (pages) */ unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */ struct vm_area_struct *attaches; /* descriptors for attaches */ }; And ours is : /* * As defined+described in "X/Open System Interfaces and Headers" * Issue 4, p. XXX */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission structure */ int shm_segsz; /* size of segment in bytes */ pid_t shm_lpid; /* process ID of last shared memory op */ pid_t shm_cpid; /* process ID of creator */ short shm_nattch; /* number of current attaches */ time_t shm_atime; /* time of last shmat() */ time_t shm_dtime; /* time of last shmdt() */ time_t shm_ctime; /* time of last change by shmctl() */ void *shm_internal; /* sysv stupidity */ }; This might be moderately tricky; you would have to identify whether the segment was created Linux-style or BSD-style and handle it accordingly. > Marc van Kempen BowTie Technology -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[