Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP Newsgroups: comp.unix.wizards Subject: Re: Motorola shared memory questions Message-ID: <5809@ncoast.UUCP> Date: Wed, 25-Nov-87 19:33:42 EST Article-I.D.: ncoast.5809 Posted: Wed Nov 25 19:33:42 1987 Date-Received: Sun, 29-Nov-87 04:24:19 EST References: <106600017@datacube> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 22 As quoted from <106600017@datacube> by ftw@datacube.UUCP: +--------------- | In Motorola's Sys V port, they have added extensions to the shmget() function | that allows physical addresses to be mapped. The default parameters for | my system allow up to 128K bytes to be bought per-call. I need more space | than this, so I call shmget() more than once, and I call shmat() to get | back the corresponding virtual addresses. The addresses that come out of | shmat() result in a non-contiguous virtual address space. I really need | it to be contiguous. The second argument to shmat() can be NULL, or a | valid user virtual address. I've tried buying memory with malloc() and | passing that pointer to shmat, but I always get EINVAL from shmat(). +--------------- You're trying to attach two pieces of memory to the same address. The way to do this is to call shmat() with NULL the first time, then for the others pass the virtual address immediately following the end of the previous segment (i.e. for the second, pass the address returned by shmat() plus the size of the segment, and so on). -- Brandon S. Allbery necntc!ncoast!allbery@harvard.harvard.edu {hoptoad,harvard!necntc,{sun,cbosgd}!mandrill!hal,uunet!hnsurg3}!ncoast!allbery Moderator of comp.sources.misc