Re: [linux-audio-dev] shared memory tools?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] shared memory tools?
From: Kjetil S. Matheussen (k.s.matheussen_AT_notam02.no)
Date: Thu Mar 06 2003 - 21:33:59 EET


On Thu, 6 Mar 2003, Juhana Sadeharju wrote:

> Hello. I need two functions:
>
> make_shm(int size, char *key)
> -run by root
> -creates a locked shared memory segment
> -returns a key (preferably a string) which is used to
> access the shared memory
>
> char *request_shm(char *key)
> -run by users
> -returns the address of the requested shared memory segment
>
> Could somebody please write these routines to me? Or give good
> hints? I have Jack and other codes, but it all is confusing
> when the shared memory should be accessed from separate process
> which is not fork() of the other.
>

The sharedmem handlers in the aipc package, (which I'm sort of
working on), is extremely easy to use.

Just define a common filename_prefix for all your processes,
and let them call the function:

struct aipc_sharedmem *aipc_sharedmem_new(
                                          char *filenames_prefix,
                                          int size,
                                          int timeout
                                          )

The first process to call this function with the same
filenames_prefix argument, and a size larger than 0,
will allocate the memory. If size is 0, the function
will wait for 'timeout' usecs and either give up and
return NULL, or return shared memory.

This might not be exactly what you're looking for, but at
least it'll give you a start.

You can find aipc at http://www.notam02.no/arkiv/src/k_jack.tar.gz/aipc/

-- 


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Mar 06 2003 - 21:34:40 EET