Date: Mon, 18 Aug 1997 11:25:11 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: marc@bowtie.nl Cc: emulation@FreeBSD.ORG Subject: Re: semget in linux emulation? Message-ID: <199708180155.LAA08632@genesis.atrad.adelaide.edu.au> In-Reply-To: <199708050922.LAA04626@nietzsche.bowtie.nl> from Marc van Kempen at "Aug 5, 97 11:22:13 am"
next in thread | previous in thread | raw e-mail | index | archive | help
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 [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708180155.LAA08632>